Preserve argument indexes when inlining MIR
We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining. We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index.
This commit is contained in:
parent
7cd6f55323
commit
a6292676eb
8 changed files with 67 additions and 7 deletions
|
@ -1115,6 +1115,11 @@ pub struct VarDebugInfo<'tcx> {
|
|||
|
||||
/// Where the data for this user variable is to be found.
|
||||
pub value: VarDebugInfoContents<'tcx>,
|
||||
|
||||
/// When present, indicates what argument number this variable is in the function that it
|
||||
/// originated from (starting from 1). Note, if MIR inlining is enabled, then this is the
|
||||
/// argument number in the original function before it was inlined.
|
||||
pub argument_index: Option<u16>,
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue