@@ -39,9 +39,10 @@ impl<'a, 'tcx> Analysis<'tcx> for Borrowck<'a, 'tcx> {
3939 }
4040 }
4141
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 ) ;
4546 }
4647
4748 fn apply_early_statement_effect (
@@ -83,30 +84,36 @@ impl<'a, 'tcx> Analysis<'tcx> for Borrowck<'a, 'tcx> {
8384 term : & ' mir mir:: Terminator < ' tcx > ,
8485 loc : Location ,
8586 ) -> 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) ;
8991
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
9396 }
9497
9598 fn apply_call_return_effect (
9699 & 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 > ,
100103 ) {
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) ;
103107 }
104108}
105109
106110impl 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
110117 }
111118}
112119
0 commit comments