You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Main Crateuse macro_hack::define_macro;fnmain(){define_macro!(macro_name);// not this onemacro_name!();// only here, and only the identifier, not the parentheses or the '!'}
Moving the text cursor into the second macro_name causes a panic. The panic doesn't happen if the text cursor is moved directly from the first macro_name to the second.
The panic output:
request: textDocument/documentHighlight DocumentHighlightParams {
text_document_position_params: TextDocumentPositionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/c%3A/Users/user/[...]/rust-analyzer-bug/src/main.rs",
query: None,
fragment: None,
},
},
position: Position {
line: 3,
character: 4,
},
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
thread 'Worker' panicked at crates\hir\src\semantics.rs:1554:13:
[...]
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:652
1: core::panicking::panic_fmt
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\panicking.rs:72
2: hir::semantics::SemanticsImpl::find_file
3: ide_db::defs::NameClass::classify
4: ide_db::search::FindUsages::search
5: hashbrown::raw::RawIterRange<T>::fold_impl
6: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
7: <hashbrown::map::HashMap<K,V,S,A> as core::iter::traits::collect::Extend<(K,V)>>::extend
8: std::panicking::try
9: rust_analyzer::handlers::request::handle_document_highlight
10: std::panicking::try
11: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 8:43:12 PM] Request textDocument/documentHighlight failed.
Message: request handler panicked:
Failed to lookup MACRO_RULES@0..32 in this Semantics.
Make sure to use only query nodes, derived from this instance of Semantics.
root node: MACRO_STMTS@0..32
known nodes: SOURCE_FILE@0..94
Code: -32603
The text was updated successfully, but these errors were encountered:
rust-analyzer version:
0.3.2029-standalone (a5b21ea0a 2024-07-07)
rustc version:
rustc 1.77.0 (aedd173a2 2024-03-17)
editor or extension:
VSCode. (extension version: v0.3.2029)
code snippet to reproduce:
Define a proc macro that expands into a declarative macro.
Moving the text cursor into the second
macro_name
causes a panic. The panic doesn't happen if the text cursor is moved directly from the firstmacro_name
to the second.The panic output:
The text was updated successfully, but these errors were encountered: