rustc_mir: properly map scope parent chains into the caller when inlining.

This commit is contained in:
Eduard-Mihai Burtescu 2020-09-21 07:13:34 +03:00
parent 6451b39a25
commit 387e31c9a7
8 changed files with 72 additions and 19 deletions

View file

@ -435,6 +435,11 @@ impl Inliner<'tcx> {
let mut scope_map = IndexVec::with_capacity(callee_body.source_scopes.len());
for mut scope in callee_body.source_scopes.iter().cloned() {
// Map the callee scopes into the caller.
// FIXME(eddyb) this may ICE if the scopes are out of order.
scope.parent_scope = scope.parent_scope.map(|s| scope_map[s]);
scope.inlined_parent_scope = scope.inlined_parent_scope.map(|s| scope_map[s]);
if scope.parent_scope.is_none() {
let callsite_scope = &caller_body.source_scopes[callsite.source_info.scope];