fix: Do not merge spans if they have different anchors

This commit is contained in:
Lukas Wirth 2024-12-29 11:29:32 +01:00
parent dc6cea57a2
commit 49b509310c

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()),