Rollup merge of #128197 - Alexendoo:span-ctxt, r=davidtwco

Skip locking span interner for some syntax context checks

- `from_expansion` now never needs to consult the interner
- `eq_ctxt` now only needs the interner when both spans are fully interned
This commit is contained in:
Matthias Krüger
2024-11-14 20:45:12 +01:00
committed by GitHub
2 changed files with 11 additions and 9 deletions

View File

@@ -559,12 +559,6 @@ impl Span {
!self.is_dummy() && sm.is_span_accessible(self)
}
/// Returns `true` if this span comes from any kind of macro, desugaring or inlining.
#[inline]
pub fn from_expansion(self) -> bool {
!self.ctxt().is_root()
}
/// 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, _))