about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2024-12-29 11:29:32 +0100
committerLukas Wirth <lukastw97@gmail.com>2024-12-29 11:29:32 +0100
commit1f0696de4300a3bce39352f1d50364711b3694b7 (patch)
tree0690f9b2c33f731f812a8df0a96571c15f24a73c
parent47f497d6365f28bf165cef24bcb728c7f3b4ab36 (diff)
downloadrust-1f0696de4300a3bce39352f1d50364711b3694b7.tar.gz
rust-1f0696de4300a3bce39352f1d50364711b3694b7.zip
fix: Do not merge spans if they have different anchors
-rw-r--r--src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs b/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs
index 3a05b83e497..add6b1d5e04 100644
--- a/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs
@@ -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()),