diff --git a/compiler/rustc_data_structures/src/graph/dominators/mod.rs b/compiler/rustc_data_structures/src/graph/dominators/mod.rs index ad62e3c9fc8f4..1cd170599ba51 100644 --- a/compiler/rustc_data_structures/src/graph/dominators/mod.rs +++ b/compiler/rustc_data_structures/src/graph/dominators/mod.rs @@ -85,6 +85,10 @@ pub struct Dominators { } impl Dominators { + pub fn dummy() -> Self { + Self { post_order_rank: IndexVec::new(), immediate_dominators: IndexVec::new() } + } + pub fn is_reachable(&self, node: Node) -> bool { self.immediate_dominators[node].is_some() } diff --git a/compiler/rustc_mir/src/borrow_check/mod.rs b/compiler/rustc_mir/src/borrow_check/mod.rs index 0bd0a4060b599..375d464917118 100644 --- a/compiler/rustc_mir/src/borrow_check/mod.rs +++ b/compiler/rustc_mir/src/borrow_check/mod.rs @@ -266,7 +266,6 @@ fn do_mir_borrowck<'a, 'tcx>( for (idx, move_data_results) in promoted_errors { let promoted_body = &promoted[idx]; - let dominators = promoted_body.dominators(); if let Err((move_data, move_errors)) = move_data_results { let mut promoted_mbcx = MirBorrowckCtxt { @@ -274,7 +273,7 @@ fn do_mir_borrowck<'a, 'tcx>( param_env, body: promoted_body, move_data: &move_data, - location_table: &LocationTable::new(promoted_body), + location_table, // no need to create a real one for the promoted, it is not used movable_generator, fn_self_span_reported: Default::default(), locals_are_invalidated_at_exit, @@ -288,7 +287,7 @@ fn do_mir_borrowck<'a, 'tcx>( used_mut: Default::default(), used_mut_upvars: SmallVec::new(), borrow_set: Rc::clone(&borrow_set), - dominators, + dominators: Dominators::dummy(), // not used upvars: Vec::new(), local_names: IndexVec::from_elem(None, &promoted_body.local_decls), region_names: RefCell::default(),