Skip to content

Commit 78d85fc

Browse files
committed
rustc_mir: fix inliner to also copy over source_scope_local_data.
1 parent 30a9978 commit 78d85fc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/librustc_mir/transform/inline.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,25 @@ impl Inliner<'tcx> {
388388
let mut local_map = IndexVec::with_capacity(callee_body.local_decls.len());
389389
let mut scope_map = IndexVec::with_capacity(callee_body.source_scopes.len());
390390

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

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

399405
let idx = caller_body.source_scopes.push(scope);
400406
scope_map.push(idx);
407+
408+
let local_data = callee_body.source_scope_local_data[callee_idx].clone();
409+
assert_eq!(idx, caller_body.source_scope_local_data.push(local_data));
401410
}
402411

403412
for loc in callee_body.vars_and_temps_iter() {

0 commit comments

Comments
 (0)