1
Fork 0

Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obk

rustc_mir: track inlined callees in SourceScopeData.

We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates.
This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default.

Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).`

Fixes #76997.

r? `@rust-lang/wg-mir-opt`
This commit is contained in:
bors 2020-10-26 18:50:22 +00:00
commit 0da6d42f29
68 changed files with 879 additions and 619 deletions

View file

@ -334,7 +334,7 @@ struct Builder<'a, 'tcx> {
/// The vector of all scopes that we have created thus far;
/// we track this for debuginfo later.
source_scopes: IndexVec<SourceScope, SourceScopeData>,
source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
source_scope: SourceScope,
/// The guard-context: each time we build the guard expression for

View file

@ -705,6 +705,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
self.source_scopes.push(SourceScopeData {
span,
parent_scope: Some(parent),
inlined: None,
inlined_parent_scope: None,
local_data: ClearCrossCrate::Set(scope_local_data),
})
}