Merge pull request #18784 from Veykril/push-pqtwsvquxoty

fix: Do not merge spans if they have different anchors
This commit is contained in:
Lukas Wirth 2024-12-29 10:44:04 +00:00 committed by GitHub
commit 0337e79c5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1058,7 +1058,7 @@ where
// We don't do what rustc does exactly, rustc does something clever when the spans have different syntax contexts
// but this runs afoul of our separation between `span` and `hir-expand`.
SpanData {
range: if a.ctx == b.ctx {
range: if a.ctx == b.ctx && a.anchor == b.anchor {
TextRange::new(
std::cmp::min(a.range.start(), b.range.start()),
std::cmp::max(a.range.end(), b.range.end()),