Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rustc_mir: fix inliner to also copy over source_scope_local_data.
  • Loading branch information
eddyb committed Nov 29, 2019
commit 78d85fcf52363f1237b877ea5b7b5583cd833894
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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Centril @wesleywiser this PR may in fact be fixing the inliner ICE encountered during stage2 building

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