From 78d85fcf52363f1237b877ea5b7b5583cd833894 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Tue, 26 Nov 2019 19:55:32 +0200 Subject: rustc_mir: fix inliner to also copy over source_scope_local_data. --- src/librustc_mir/transform/inline.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 867673beb35..70a0fb2d103 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/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() { -- cgit 1.4.1-3-g733a5