Skip to content

Commit 2918062

Browse files
committed
Auto merge of #81129 - bugadani:lighter-move-errors, r=petrochenkov
Borrowck: don't calculate unused info when reporting move errors
2 parents 1efd804 + 3c1d792 commit 2918062

File tree

2 files changed

+6
-3
lines changed
  • compiler
    • rustc_data_structures/src/graph/dominators
    • rustc_mir/src/borrow_check

2 files changed

+6
-3
lines changed

compiler/rustc_data_structures/src/graph/dominators/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ pub struct Dominators<N: Idx> {
8585
}
8686

8787
impl<Node: Idx> Dominators<Node> {
88+
pub fn dummy() -> Self {
89+
Self { post_order_rank: IndexVec::new(), immediate_dominators: IndexVec::new() }
90+
}
91+
8892
pub fn is_reachable(&self, node: Node) -> bool {
8993
self.immediate_dominators[node].is_some()
9094
}

compiler/rustc_mir/src/borrow_check/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,14 @@ fn do_mir_borrowck<'a, 'tcx>(
266266

267267
for (idx, move_data_results) in promoted_errors {
268268
let promoted_body = &promoted[idx];
269-
let dominators = promoted_body.dominators();
270269

271270
if let Err((move_data, move_errors)) = move_data_results {
272271
let mut promoted_mbcx = MirBorrowckCtxt {
273272
infcx,
274273
param_env,
275274
body: promoted_body,
276275
move_data: &move_data,
277-
location_table: &LocationTable::new(promoted_body),
276+
location_table, // no need to create a real one for the promoted, it is not used
278277
movable_generator,
279278
fn_self_span_reported: Default::default(),
280279
locals_are_invalidated_at_exit,
@@ -288,7 +287,7 @@ fn do_mir_borrowck<'a, 'tcx>(
288287
used_mut: Default::default(),
289288
used_mut_upvars: SmallVec::new(),
290289
borrow_set: Rc::clone(&borrow_set),
291-
dominators,
290+
dominators: Dominators::dummy(), // not used
292291
upvars: Vec::new(),
293292
local_names: IndexVec::from_elem(None, &promoted_body.local_decls),
294293
region_names: RefCell::default(),

0 commit comments

Comments
 (0)