Skip to content

Commit

Permalink
rustc_mir: fix inliner to also copy over source_scope_local_data.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Nov 28, 2019
1 parent fd40d0c commit 314f8d5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/librustc_mir/transform/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 314f8d5

Please sign in to comment.