1
Fork 0

rustc_mir: support MIR-inlining #[track_caller] functions.

This commit is contained in:
Eduard-Mihai Burtescu 2020-09-21 06:52:37 +03:00
parent fb36440b7a
commit 6451b39a25
8 changed files with 144 additions and 52 deletions

View file

@ -1878,6 +1878,11 @@ pub struct SourceScopeData<'tcx> {
/// `ty::Instance` is the callee, and the `Span` is the call site.
pub inlined: Option<(ty::Instance<'tcx>, Span)>,
/// Nearest (transitive) parent scope (if any) which is inlined.
/// This is an optimization over walking up `parent_scope`
/// until a scope with `inlined: Some(...)` is found.
pub inlined_parent_scope: Option<SourceScope>,
/// Crate-local information for this source scope, that can't (and
/// needn't) be tracked across crates.
pub local_data: ClearCrossCrate<SourceScopeLocalData>,

View file

@ -325,6 +325,7 @@ macro_rules! make_mir_visitor {
span,
parent_scope,
inlined,
inlined_parent_scope,
local_data: _,
} = scope_data;
@ -357,6 +358,9 @@ macro_rules! make_mir_visitor {
}
self.visit_substs(callee_substs, location);
}
if let Some(inlined_parent_scope) = inlined_parent_scope {
self.visit_source_scope(inlined_parent_scope);
}
}
fn super_statement(&mut self,