Skip to content
Permalink
Browse files

rustc_mir: fix inliner to also copy over source_scope_local_data.

  • Loading branch information
eddyb committed Nov 26, 2019
1 parent 30a9978 commit 78d85fcf52363f1237b877ea5b7b5583cd833894
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/librustc_mir/transform/inline.rs
@@ -388,16 +388,25 @@ impl Inliner<'tcx> {
let mut local_map = IndexVec::with_capacity(callee_body.local_decls.len());
let mut scope_map = IndexVec::with_capacity(callee_body.source_scopes.len());

for mut scope in callee_body.source_scopes.iter().cloned() {
for (callee_idx, scope) in callee_body.source_scopes.iter_enumerated() {
let mut scope = scope.clone();
if scope.parent_scope.is_none() {
scope.parent_scope = Some(callsite.location.scope);
// FIXME(eddyb) is this really needed?
// (also note that it's always overwritten below)
scope.span = callee_body.span;
}

// FIXME(eddyb) this doesn't seem right at all.
// The inlined source scopes should probably be annotated as
// such, but also contain all of the original information.
scope.span = callsite.location.span;

let idx = caller_body.source_scopes.push(scope);
scope_map.push(idx);

let local_data = callee_body.source_scope_local_data[callee_idx].clone();
assert_eq!(idx, caller_body.source_scope_local_data.push(local_data));
}

for loc in callee_body.vars_and_temps_iter() {

0 comments on commit 78d85fc

Please sign in to comment.
You can’t perform that action at this time.