Auto merge of #119531 - petrochenkov:cmpctxt, r=cjgillot
rustc_span: Optimize syntax context comparisons Including comparisons with root context. - `eq_ctxt` doesn't require retrieving full `SpanData`, or taking the span interner lock twice. - Checking `SyntaxContext` for "rootness" is cheaper than extracting a full outer `ExpnData` for it and checking *it* for rootness. The internal lint for `eq_ctxt` is also tweaked to detect `a.ctxt() != b.ctxt()` in addition to `a.ctxt() == b.ctxt()`.
This commit is contained in:
commit
9212108a9b
13 changed files with 76 additions and 52 deletions
|
@ -1621,7 +1621,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
|||
let from_macro = non_shorthands
|
||||
.iter()
|
||||
.find(|(_, pat_span, ident_span)| {
|
||||
pat_span.ctxt() != ident_span.ctxt() && pat_span.from_expansion()
|
||||
!pat_span.eq_ctxt(*ident_span) && pat_span.from_expansion()
|
||||
})
|
||||
.map(|(_, pat_span, _)| *pat_span);
|
||||
let non_shorthands = non_shorthands
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue