rust-analyzer version: 0.3.2929-standalone (panic message below is from a source build of master with force-always-assert; on the release build the assist silently does nothing and only logs the error)
rustc version: rustc 1.97.0-nightly (ca9a134e0 2026-04-26)
editor or extension: VSCode, rust-analyzer extension 0.3.2929
relevant settings: none
repository link (if public, optional): n/a
code snippet to reproduce:
macro_rules! m { ($e:expr) => { ($e, $e) }; }
fn main() {
let t = (1,);
m!(t.0);
}
reproduce:
cursor on t in let t = (1,);
Destructure tuple
expected:
let (_0,) = (1,); and m!(_0);, or the assist bails on the macro usage. either way no crash.
actual:
on the release build the assist is offered, applies nothing, and logs the error. on a build with debug assertions the request handler panics:
request handler panicked: some replace change ranges intersect!
left change: ReplaceAll(Token(IDENT@194..195 "t")..=Token(INT_NUMBER@196..197 "0"), [Node(PATH_EXPR@0..2)]) (t.0_0)
equals
right change: ReplaceAll(Token(IDENT@194..195 "t")..=Token(INT_NUMBER@196..197 "0"), [Node(PATH_EXPR@0..2)]) (t.0_0)
panicked at crates/syntax/src/syntax_editor/edit_algo.rs:478:5:
some replace change ranges intersect!
cause:
the macro expands $e twice, so FindUsages descends into the expansion and returns two FileReferences for the single t token in the source. the handler maps each one back with original_range_opt + cover_edit_range and calls SyntaxEditor::replace_all for both, registering two identical ReplaceAll changes. the disjointness check in edit_algo.rs then trips stdx::always!(false, "some replace change ranges intersect!") and the whole edit is discarded.
env:
- rustc: 1.97.0-nightly
- rust-analyzer: 0.3.2929
- OS: Ubuntu
- Editor: VS Code
rust-analyzer version: 0.3.2929-standalone (panic message below is from a source build of master with
force-always-assert; on the release build the assist silently does nothing and only logs the error)rustc version: rustc 1.97.0-nightly (ca9a134e0 2026-04-26)
editor or extension: VSCode, rust-analyzer extension 0.3.2929
relevant settings: none
repository link (if public, optional): n/a
code snippet to reproduce:
reproduce:
cursor on
tinlet t = (1,);Destructure tuple
expected:
let (_0,) = (1,);andm!(_0);, or the assist bails on the macro usage. either way no crash.actual:
on the release build the assist is offered, applies nothing, and logs the error. on a build with debug assertions the request handler panics:
cause:
the macro expands
$etwice, soFindUsagesdescends into the expansion and returns twoFileReferences for the singlettoken in the source. the handler maps each one back withoriginal_range_opt+cover_edit_rangeand callsSyntaxEditor::replace_allfor both, registering two identicalReplaceAllchanges. the disjointness check inedit_algo.rsthen tripsstdx::always!(false, "some replace change ranges intersect!")and the whole edit is discarded.env: