@@ -36,76 +36,73 @@ pub type BorrowckResults<'mir, 'tcx> = BorrowckAnalyses<
36
36
pub type BorrowckFlowState < ' mir , ' tcx > =
37
37
<BorrowckResults < ' mir , ' tcx > as ResultsVisitable < ' tcx > >:: FlowState ;
38
38
39
- macro_rules! impl_visitable {
40
- ( $(
41
- $T: ident { $( $field: ident : $A: ident ) ,* $( , ) ? }
42
- ) * ) => { $(
43
- impl <' tcx, $( $A) ,* , D : Direction > ResultsVisitable <' tcx> for $T<$( Results <' tcx, $A> ) ,* >
44
- where
45
- $( $A: Analysis <' tcx, Direction = D >, ) *
46
- {
47
- type Direction = D ;
48
- type FlowState = $T<$( $A:: Domain ) ,* >;
49
-
50
- fn new_flow_state( & self , body: & mir:: Body <' tcx>) -> Self :: FlowState {
51
- $T {
52
- $( $field: self . $field. analysis. bottom_value( body) ) ,*
53
- }
54
- }
55
-
56
- fn reset_to_block_entry(
57
- & self ,
58
- state: & mut Self :: FlowState ,
59
- block: BasicBlock ,
60
- ) {
61
- $( state. $field. clone_from( & self . $field. entry_set_for_block( block) ) ; ) *
62
- }
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 > ;
48
+
49
+ fn new_flow_state ( & self , body : & mir:: Body < ' tcx > ) -> Self :: FlowState {
50
+ BorrowckAnalyses {
51
+ borrows : self . borrows . analysis . bottom_value ( body) ,
52
+ uninits : self . uninits . analysis . bottom_value ( body) ,
53
+ ever_inits : self . ever_inits . analysis . bottom_value ( body) ,
54
+ }
55
+ }
63
56
64
- fn reconstruct_before_statement_effect(
65
- & mut self ,
66
- state: & mut Self :: FlowState ,
67
- stmt: & mir:: Statement <' tcx>,
68
- loc: Location ,
69
- ) {
70
- $( self . $field. analysis
71
- . apply_before_statement_effect( & mut state. $field, stmt, loc) ; ) *
72
- }
57
+ fn reset_to_block_entry ( & self , state : & mut Self :: FlowState , block : BasicBlock ) {
58
+ state. borrows . clone_from ( & self . borrows . entry_set_for_block ( block) ) ;
59
+ state. uninits . clone_from ( & self . uninits . entry_set_for_block ( block) ) ;
60
+ state. ever_inits . clone_from ( & self . ever_inits . entry_set_for_block ( block) ) ;
61
+ }
73
62
74
- fn reconstruct_statement_effect(
75
- & mut self ,
76
- state: & mut Self :: FlowState ,
77
- stmt: & mir:: Statement <' tcx>,
78
- loc: Location ,
79
- ) {
80
- $( self . $field. analysis
81
- . apply_statement_effect( & mut state. $field, stmt, loc) ; ) *
82
- }
63
+ fn reconstruct_before_statement_effect (
64
+ & mut self ,
65
+ state : & mut Self :: FlowState ,
66
+ stmt : & mir:: Statement < ' tcx > ,
67
+ loc : Location ,
68
+ ) {
69
+ self . borrows . analysis . apply_before_statement_effect ( & mut state. borrows , stmt, loc) ;
70
+ self . uninits . analysis . apply_before_statement_effect ( & mut state. uninits , stmt, loc) ;
71
+ self . ever_inits . analysis . apply_before_statement_effect ( & mut state. ever_inits , stmt, loc) ;
72
+ }
83
73
84
- fn reconstruct_before_terminator_effect(
85
- & mut self ,
86
- state: & mut Self :: FlowState ,
87
- term: & mir:: Terminator <' tcx>,
88
- loc: Location ,
89
- ) {
90
- $( self . $field. analysis
91
- . apply_before_terminator_effect( & mut state. $field, term, loc) ; ) *
92
- }
74
+ fn reconstruct_statement_effect (
75
+ & mut self ,
76
+ state : & mut Self :: FlowState ,
77
+ stmt : & mir:: Statement < ' tcx > ,
78
+ loc : Location ,
79
+ ) {
80
+ self . borrows . analysis . apply_statement_effect ( & mut state. borrows , stmt, loc) ;
81
+ self . uninits . analysis . apply_statement_effect ( & mut state. uninits , stmt, loc) ;
82
+ self . ever_inits . analysis . apply_statement_effect ( & mut state. ever_inits , stmt, loc) ;
83
+ }
93
84
94
- fn reconstruct_terminator_effect(
95
- & mut self ,
96
- state: & mut Self :: FlowState ,
97
- term: & mir:: Terminator <' tcx>,
98
- loc: Location ,
99
- ) {
100
- $( self . $field. analysis
101
- . apply_terminator_effect( & mut state. $field, term, loc) ; ) *
102
- }
103
- }
104
- ) * }
105
- }
85
+ fn reconstruct_before_terminator_effect (
86
+ & mut self ,
87
+ state : & mut Self :: FlowState ,
88
+ term : & mir:: Terminator < ' tcx > ,
89
+ loc : Location ,
90
+ ) {
91
+ self . borrows . analysis . apply_before_terminator_effect ( & mut state. borrows , term, loc) ;
92
+ self . uninits . analysis . apply_before_terminator_effect ( & mut state. uninits , term, loc) ;
93
+ self . ever_inits . analysis . apply_before_terminator_effect ( & mut state. ever_inits , term, loc) ;
94
+ }
106
95
107
- impl_visitable ! {
108
- BorrowckAnalyses { borrows: B , uninits: U , ever_inits: E }
96
+ fn reconstruct_terminator_effect (
97
+ & mut self ,
98
+ state : & mut Self :: FlowState ,
99
+ term : & mir:: Terminator < ' tcx > ,
100
+ loc : Location ,
101
+ ) {
102
+ self . borrows . analysis . apply_terminator_effect ( & mut state. borrows , term, loc) ;
103
+ self . uninits . analysis . apply_terminator_effect ( & mut state. uninits , term, loc) ;
104
+ self . ever_inits . analysis . apply_terminator_effect ( & mut state. ever_inits , term, loc) ;
105
+ }
109
106
}
110
107
111
108
rustc_index:: newtype_index! {
0 commit comments