Skip to content

Commit 848187c

Browse files
committed
local_names creation to mbcx creation
1 parent 8cb7274 commit 848187c

File tree

1 file changed

+20
-20
lines changed
  • compiler/rustc_borrowck/src

1 file changed

+20
-20
lines changed

Diff for: compiler/rustc_borrowck/src/lib.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -304,26 +304,6 @@ fn do_mir_borrowck<'tcx>(
304304
root_cx.set_tainted_by_errors(e);
305305
}
306306

307-
let mut local_names = IndexVec::from_elem(None, &input_body.local_decls);
308-
for var_debug_info in &input_body.var_debug_info {
309-
if let VarDebugInfoContents::Place(place) = var_debug_info.value {
310-
if let Some(local) = place.as_local() {
311-
if let Some(prev_name) = local_names[local]
312-
&& var_debug_info.name != prev_name
313-
{
314-
span_bug!(
315-
var_debug_info.source_info.span,
316-
"local {:?} has many names (`{}` vs `{}`)",
317-
local,
318-
prev_name,
319-
var_debug_info.name
320-
);
321-
}
322-
local_names[local] = Some(var_debug_info.name);
323-
}
324-
}
325-
}
326-
327307
// Replace all regions with fresh inference variables. This
328308
// requires first making our own copy of the MIR. This copy will
329309
// be modified (in place) to contain non-lexical lifetimes. It
@@ -426,6 +406,26 @@ fn do_mir_borrowck<'tcx>(
426406
promoted_mbcx.report_move_errors();
427407
}
428408

409+
let mut local_names = IndexVec::from_elem(None, &body.local_decls);
410+
for var_debug_info in &body.var_debug_info {
411+
if let VarDebugInfoContents::Place(place) = var_debug_info.value {
412+
if let Some(local) = place.as_local() {
413+
if let Some(prev_name) = local_names[local]
414+
&& var_debug_info.name != prev_name
415+
{
416+
span_bug!(
417+
var_debug_info.source_info.span,
418+
"local {:?} has many names (`{}` vs `{}`)",
419+
local,
420+
prev_name,
421+
var_debug_info.name
422+
);
423+
}
424+
local_names[local] = Some(var_debug_info.name);
425+
}
426+
}
427+
}
428+
429429
let mut mbcx = MirBorrowckCtxt {
430430
root_cx,
431431
infcx: &infcx,

0 commit comments

Comments
 (0)