1
Fork 0

Improved support of collapse_debuginfo attribute for macros.

This commit is contained in:
Andrew Zhogin 2023-11-29 12:49:48 +07:00
parent ca9ff83f1b
commit f2dbebafad
8 changed files with 513 additions and 39 deletions

View file

@ -568,13 +568,6 @@ impl Span {
self.ctxt() != SyntaxContext::root()
}
/// Returns `true` if `span` originates in a macro's expansion where debuginfo should be
/// collapsed.
pub fn in_macro_expansion_with_collapse_debuginfo(self) -> bool {
let outer_expn = self.ctxt().outer_expn_data();
matches!(outer_expn.kind, ExpnKind::Macro(..)) && outer_expn.collapse_debuginfo
}
/// Returns `true` if `span` originates in a derive-macro's expansion.
pub fn in_derive_expansion(self) -> bool {
matches!(self.ctxt().outer_expn_data().kind, ExpnKind::Macro(MacroKind::Derive, _))