Auto merge of #81129 - bugadani:lighter-move-errors, r=petrochenkov

Borrowck: don't calculate unused info when reporting move errors
This commit is contained in:
bors 2021-02-11 07:50:02 +00:00
commit 2918062d1d
2 changed files with 6 additions and 3 deletions

View File

@ -85,6 +85,10 @@ pub struct Dominators<N: Idx> {
}
impl<Node: Idx> Dominators<Node> {
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()
}

View File

@ -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(),