diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-11-26 19:55:32 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-11-30 01:36:51 +0200 |
| commit | 78d85fcf52363f1237b877ea5b7b5583cd833894 (patch) | |
| tree | 457e6a74eae048fcc970dd3a616c37218a9404f1 | |
| parent | 30a9978c6c8eb257a17e562f23690291ba1fc979 (diff) | |
| download | rust-78d85fcf52363f1237b877ea5b7b5583cd833894.tar.gz rust-78d85fcf52363f1237b877ea5b7b5583cd833894.zip | |
rustc_mir: fix inliner to also copy over source_scope_local_data.
| -rw-r--r-- | src/librustc_mir/transform/inline.rs | 11 |
1 files changed, 10 insertions, 1 deletions
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() { |
