@@ -43,7 +43,6 @@ use rustc_target::abi::FieldIdx;
43
43
44
44
use either:: Either ;
45
45
use smallvec:: SmallVec ;
46
- use std:: cell:: OnceCell ;
47
46
use std:: cell:: RefCell ;
48
47
use std:: collections:: BTreeMap ;
49
48
use std:: ops:: Deref ;
@@ -331,7 +330,7 @@ fn do_mir_borrowck<'tcx>(
331
330
used_mut : Default :: default ( ) ,
332
331
used_mut_upvars : SmallVec :: new ( ) ,
333
332
borrow_set : Rc :: clone ( & borrow_set) ,
334
- dominators : Default :: default ( ) ,
333
+ dominators : promoted_body . basic_blocks . dominators ( ) ,
335
334
upvars : Vec :: new ( ) ,
336
335
local_names : IndexVec :: from_elem ( None , & promoted_body. local_decls ) ,
337
336
region_names : RefCell :: default ( ) ,
@@ -360,7 +359,7 @@ fn do_mir_borrowck<'tcx>(
360
359
used_mut : Default :: default ( ) ,
361
360
used_mut_upvars : SmallVec :: new ( ) ,
362
361
borrow_set : Rc :: clone ( & borrow_set) ,
363
- dominators : Default :: default ( ) ,
362
+ dominators : body . basic_blocks . dominators ( ) ,
364
363
upvars,
365
364
local_names,
366
365
region_names : RefCell :: default ( ) ,
@@ -592,7 +591,7 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
592
591
borrow_set : Rc < BorrowSet < ' tcx > > ,
593
592
594
593
/// Dominators for MIR
595
- dominators : OnceCell < Dominators < BasicBlock > > ,
594
+ dominators : & ' cx Dominators < BasicBlock > ,
596
595
597
596
/// Information about upvars not necessarily preserved in types or MIR
598
597
upvars : Vec < Upvar < ' tcx > > ,
@@ -1103,7 +1102,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1103
1102
1104
1103
( Read ( kind) , BorrowKind :: Unique | BorrowKind :: Mut { .. } ) => {
1105
1104
// 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) {
1107
1106
assert ! ( allow_two_phase_borrow( borrow. kind) ) ;
1108
1107
return Control :: Continue ;
1109
1108
}
@@ -2267,10 +2266,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2267
2266
fn is_upvar_field_projection ( & self , place_ref : PlaceRef < ' tcx > ) -> Option < FieldIdx > {
2268
2267
path_utils:: is_upvar_field_projection ( self . infcx . tcx , & self . upvars , place_ref, self . body ( ) )
2269
2268
}
2270
-
2271
- fn dominators ( & self ) -> & Dominators < BasicBlock > {
2272
- self . dominators . get_or_init ( || self . body . basic_blocks . dominators ( ) )
2273
- }
2274
2269
}
2275
2270
2276
2271
mod error {
0 commit comments