@@ -43,7 +43,6 @@ use rustc_target::abi::FieldIdx;
4343
4444use either:: Either ;
4545use smallvec:: SmallVec ;
46- use std:: cell:: OnceCell ;
4746use std:: cell:: RefCell ;
4847use std:: collections:: BTreeMap ;
4948use std:: ops:: Deref ;
@@ -331,7 +330,7 @@ fn do_mir_borrowck<'tcx>(
331330 used_mut : Default :: default ( ) ,
332331 used_mut_upvars : SmallVec :: new ( ) ,
333332 borrow_set : Rc :: clone ( & borrow_set) ,
334- dominators : Default :: default ( ) ,
333+ dominators : promoted_body . basic_blocks . dominators ( ) ,
335334 upvars : Vec :: new ( ) ,
336335 local_names : IndexVec :: from_elem ( None , & promoted_body. local_decls ) ,
337336 region_names : RefCell :: default ( ) ,
@@ -360,7 +359,7 @@ fn do_mir_borrowck<'tcx>(
360359 used_mut : Default :: default ( ) ,
361360 used_mut_upvars : SmallVec :: new ( ) ,
362361 borrow_set : Rc :: clone ( & borrow_set) ,
363- dominators : Default :: default ( ) ,
362+ dominators : body . basic_blocks . dominators ( ) ,
364363 upvars,
365364 local_names,
366365 region_names : RefCell :: default ( ) ,
@@ -592,7 +591,7 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
592591 borrow_set : Rc < BorrowSet < ' tcx > > ,
593592
594593 /// Dominators for MIR
595- dominators : OnceCell < Dominators < BasicBlock > > ,
594+ dominators : & ' cx Dominators < BasicBlock > ,
596595
597596 /// Information about upvars not necessarily preserved in types or MIR
598597 upvars : Vec < Upvar < ' tcx > > ,
@@ -1103,7 +1102,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11031102
11041103 ( Read ( kind) , BorrowKind :: Unique | BorrowKind :: Mut { .. } ) => {
11051104 // Reading from mere reservations of mutable-borrows is OK.
1106- if !is_active ( this. dominators ( ) , borrow, location) {
1105+ if !is_active ( this. dominators , borrow, location) {
11071106 assert ! ( allow_two_phase_borrow( borrow. kind) ) ;
11081107 return Control :: Continue ;
11091108 }
@@ -2267,10 +2266,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22672266 fn is_upvar_field_projection ( & self , place_ref : PlaceRef < ' tcx > ) -> Option < FieldIdx > {
22682267 path_utils:: is_upvar_field_projection ( self . infcx . tcx , & self . upvars , place_ref, self . body ( ) )
22692268 }
2270-
2271- fn dominators ( & self ) -> & Dominators < BasicBlock > {
2272- self . dominators . get_or_init ( || self . body . basic_blocks . dominators ( ) )
2273- }
22742269}
22752270
22762271mod error {
0 commit comments