Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiser
ssa: implement `#[collapse_debuginfo]` cc #39153 rust-lang/compiler-team#386 Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. r? rust-lang/wg-debugging
This commit is contained in:
commit
0df1ddc185
21 changed files with 700 additions and 36 deletions
|
@ -1590,7 +1590,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
})
|
||||
}
|
||||
|
||||
// Returns the `DefId` and the `BoundRegionKind` corresponding to the given region.
|
||||
/// Returns the `DefId` and the `BoundRegionKind` corresponding to the given region.
|
||||
pub fn is_suitable_region(self, region: Region<'tcx>) -> Option<FreeRegionInfo> {
|
||||
let (suitable_region_binding_scope, bound_region) = match *region {
|
||||
ty::ReFree(ref free_region) => {
|
||||
|
|
|
@ -2470,6 +2470,23 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
(ident, scope)
|
||||
}
|
||||
|
||||
/// Returns `true` if the debuginfo for `span` should be collapsed to the outermost expansion
|
||||
/// site. Only applies when `Span` is the result of macro expansion.
|
||||
///
|
||||
/// - If the `collapse_debuginfo` feature is enabled then debuginfo is not collapsed by default
|
||||
/// and only when a macro definition is annotated with `#[collapse_debuginfo]`.
|
||||
/// - If `collapse_debuginfo` is not enabled, then debuginfo is collapsed by default.
|
||||
///
|
||||
/// When `-Zdebug-macros` is provided then debuginfo will never be collapsed.
|
||||
pub fn should_collapse_debuginfo(self, span: Span) -> bool {
|
||||
!self.sess.opts.unstable_opts.debug_macros
|
||||
&& if self.features().collapse_debuginfo {
|
||||
span.in_macro_expansion_with_collapse_debuginfo()
|
||||
} else {
|
||||
span.from_expansion()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_object_safe(self, key: DefId) -> bool {
|
||||
self.object_safety_violations(key).is_empty()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue