@@ -11,43 +11,33 @@ use rustc_middle::ty::TyCtxt;
11
11
use rustc_mir_dataflow:: impls:: { EverInitializedPlaces , MaybeUninitializedPlaces } ;
12
12
use rustc_mir_dataflow:: ResultsVisitable ;
13
13
use rustc_mir_dataflow:: { self , fmt:: DebugWithContext , GenKill } ;
14
- use rustc_mir_dataflow:: { Analysis , Direction , Results } ;
14
+ use rustc_mir_dataflow:: { Analysis , AnalysisDomain , Results } ;
15
15
use std:: fmt;
16
16
17
17
use crate :: { places_conflict, BorrowSet , PlaceConflictBias , PlaceExt , RegionInferenceContext } ;
18
18
19
- /// A tuple with named fields that can hold either the results or the transient state of the
20
- /// dataflow analyses used by the borrow checker.
21
- #[ derive( Debug ) ]
22
- pub struct BorrowckAnalyses < B , U , E > {
23
- pub borrows : B ,
24
- pub uninits : U ,
25
- pub ever_inits : E ,
26
- }
27
-
28
19
/// The results of the dataflow analyses used by the borrow checker.
29
- pub type BorrowckResults < ' mir , ' tcx > = BorrowckAnalyses <
30
- Results < ' tcx , Borrows < ' mir , ' tcx > > ,
31
- Results < ' tcx , MaybeUninitializedPlaces < ' mir , ' tcx > > ,
32
- Results < ' tcx , EverInitializedPlaces < ' mir , ' tcx > > ,
33
- > ;
20
+ pub struct BorrowckResults < ' mir , ' tcx > {
21
+ pub ( crate ) borrows : Results < ' tcx , Borrows < ' mir , ' tcx > > ,
22
+ pub ( crate ) uninits : Results < ' tcx , MaybeUninitializedPlaces < ' mir , ' tcx > > ,
23
+ pub ( crate ) ever_inits : Results < ' tcx , EverInitializedPlaces < ' mir , ' tcx > > ,
24
+ }
34
25
35
26
/// The transient state of the dataflow analyses used by the borrow checker.
36
- pub type BorrowckFlowState < ' mir , ' tcx > =
37
- <BorrowckResults < ' mir , ' tcx > as ResultsVisitable < ' tcx > >:: FlowState ;
38
-
39
- impl < ' tcx , B , U , E , D : Direction > ResultsVisitable < ' tcx >
40
- for BorrowckAnalyses < Results < ' tcx , B > , Results < ' tcx , U > , Results < ' tcx , E > >
41
- where
42
- B : Analysis < ' tcx , Direction = D > ,
43
- U : Analysis < ' tcx , Direction = D > ,
44
- E : Analysis < ' tcx , Direction = D > ,
45
- {
46
- type Direction = D ;
47
- type FlowState = BorrowckAnalyses < B :: Domain , U :: Domain , E :: Domain > ;
27
+ #[ derive( Debug ) ]
28
+ pub struct BorrowckFlowState < ' mir , ' tcx > {
29
+ pub ( crate ) borrows : <Borrows < ' mir , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
30
+ pub ( crate ) uninits : <MaybeUninitializedPlaces < ' mir , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
31
+ pub ( crate ) ever_inits : <EverInitializedPlaces < ' mir , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
32
+ }
33
+
34
+ impl < ' mir , ' tcx > ResultsVisitable < ' tcx > for BorrowckResults < ' mir , ' tcx > {
35
+ // All three analyses are forward, but we have to use just one here.
36
+ type Direction = <Borrows < ' mir , ' tcx > as AnalysisDomain < ' tcx > >:: Direction ;
37
+ type FlowState = BorrowckFlowState < ' mir , ' tcx > ;
48
38
49
39
fn new_flow_state ( & self , body : & mir:: Body < ' tcx > ) -> Self :: FlowState {
50
- BorrowckAnalyses {
40
+ BorrowckFlowState {
51
41
borrows : self . borrows . analysis . bottom_value ( body) ,
52
42
uninits : self . uninits . analysis . bottom_value ( body) ,
53
43
ever_inits : self . ever_inits . analysis . bottom_value ( body) ,
0 commit comments