Closed
Description
After MIR inlining, this example (see on godbolt):
fn foo() {
let f = |x| { let y = x; y };
f(())
}
produces this scope shape (I've removed all the let
s and spans):
scope 1 {
debug f => _1;
scope 2 {
debug x => _4;
}
}
scope 3 {
debug y => _3;
}
You can see x
is properly located, in the inlined outermost callee scope (2) as a child of the callsite scope (1).
But y
isn't, as its scope (3) keeps the original parent_scope
(0) it had in the callee body, pre-inlining.
Will try to fix this as part of #68965, or maybe open a separate PR if I can shuffle the commits around.
cc @rust-lang/wg-mir-opt