@@ -39,9 +39,10 @@ impl<'a, 'tcx> Analysis<'tcx> for Borrowck<'a, 'tcx> {
39
39
}
40
40
}
41
41
42
- fn initialize_start_block ( & self , _body : & mir:: Body < ' tcx > , _state : & mut Self :: Domain ) {
43
- // This is only reachable from `iterate_to_fixpoint`, which this analysis doesn't use.
44
- unreachable ! ( ) ;
42
+ fn initialize_start_block ( & self , body : & mir:: Body < ' tcx > , state : & mut Self :: Domain ) {
43
+ self . borrows . initialize_start_block ( body, & mut state. borrows ) ;
44
+ self . uninits . initialize_start_block ( body, & mut state. uninits ) ;
45
+ self . ever_inits . initialize_start_block ( body, & mut state. ever_inits ) ;
45
46
}
46
47
47
48
fn apply_early_statement_effect (
@@ -83,30 +84,36 @@ impl<'a, 'tcx> Analysis<'tcx> for Borrowck<'a, 'tcx> {
83
84
term : & ' mir mir:: Terminator < ' tcx > ,
84
85
loc : Location ,
85
86
) -> TerminatorEdges < ' mir , ' tcx > {
86
- self . borrows . apply_primary_terminator_effect ( & mut state. borrows , term, loc) ;
87
- self . uninits . apply_primary_terminator_effect ( & mut state. uninits , term, loc) ;
88
- self . ever_inits . apply_primary_terminator_effect ( & mut state. ever_inits , term, loc) ;
87
+ let _edges1 = self . borrows . apply_primary_terminator_effect ( & mut state. borrows , term, loc) ;
88
+ let _edges2 = self . uninits . apply_primary_terminator_effect ( & mut state. uninits , term, loc) ;
89
+ let edges3 =
90
+ self . ever_inits . apply_primary_terminator_effect ( & mut state. ever_inits , term, loc) ;
89
91
90
- // This return value doesn't matter. It's only used by `iterate_to_fixpoint`, which this
91
- // analysis doesn't use.
92
- TerminatorEdges :: None
92
+ // assert_eq!(_edges1, _edges2);
93
+ // assert_eq!(_edges2, edges3);
94
+
95
+ edges3
93
96
}
94
97
95
98
fn apply_call_return_effect (
96
99
& mut self ,
97
- _state : & mut Self :: Domain ,
98
- _block : BasicBlock ,
99
- _return_places : CallReturnPlaces < ' _ , ' tcx > ,
100
+ state : & mut Self :: Domain ,
101
+ block : BasicBlock ,
102
+ return_places : CallReturnPlaces < ' _ , ' tcx > ,
100
103
) {
101
- // This is only reachable from `iterate_to_fixpoint`, which this analysis doesn't use.
102
- unreachable ! ( ) ;
104
+ self . borrows . apply_call_return_effect ( & mut state. borrows , block, return_places) ;
105
+ self . uninits . apply_call_return_effect ( & mut state. uninits , block, return_places) ;
106
+ self . ever_inits . apply_call_return_effect ( & mut state. ever_inits , block, return_places) ;
103
107
}
104
108
}
105
109
106
110
impl JoinSemiLattice for BorrowckDomain {
107
- fn join ( & mut self , _other : & Self ) -> bool {
108
- // This is only reachable from `iterate_to_fixpoint`, which this analysis doesn't use.
109
- unreachable ! ( ) ;
111
+ fn join ( & mut self , other : & Self ) -> bool {
112
+ let mut changed = false ;
113
+ changed |= self . borrows . join ( & other. borrows ) ;
114
+ changed |= self . uninits . join ( & other. uninits ) ;
115
+ changed |= self . ever_inits . join ( & other. ever_inits ) ;
116
+ changed
110
117
}
111
118
}
112
119
0 commit comments