rust-analyzer version: rust-analyzer 1.96.0 (ac68faa 2026-05-25)
rustc version: rustc 1.96.0 (ac68faa20 2026-05-25)
editor or extension: N/A
relevant settings: N/A
repository link (if public, optional): originally filed as bytecodealliance/wit-bindgen#1650
code snippet to reproduce:
Given this proc macro:
use proc_macro::TokenStream;
#[proc_macro]
pub fn run(_: TokenStream) -> TokenStream {
"\
/// this is some documentation
pub fn foo() {}
"
.parse()
.unwrap()
}
and this input:
repro_macro::run!();
fn main() {
foo();
}
rust-analyzer will incorrect show the documentation of foo as / this is some documentation (not the leading /). This is an attempt of mine with LLM help to reduce a bug report at bytecodealliance/wit-bindgen#1650 to what I think might be a bug in rust-analyzer. I don't use rust-analyzer myself, so I don't know how exactly to show this, but this CLI command for example I think shows what's going on:
$ rust-analyzer lsif . 2>/dev/null | jq -r 'select(.label == "hoverResult") | .result.contents.value | select(contains("fn foo"))'
```rust
ra_repro
```
```rust
pub fn foo()
```
---
/ this is some documentation
I believe the leading / here isn't intended as that shouldn't be part of the documentation of the function.
rust-analyzer version:
rust-analyzer 1.96.0 (ac68faa 2026-05-25)rustc version:
rustc 1.96.0 (ac68faa20 2026-05-25)editor or extension: N/A
relevant settings: N/A
repository link (if public, optional): originally filed as bytecodealliance/wit-bindgen#1650
code snippet to reproduce:
Given this proc macro:
and this input:
rust-analyzer will incorrect show the documentation of
fooas/ this is some documentation(not the leading/). This is an attempt of mine with LLM help to reduce a bug report at bytecodealliance/wit-bindgen#1650 to what I think might be a bug in rust-analyzer. I don't use rust-analyzer myself, so I don't know how exactly to show this, but this CLI command for example I think shows what's going on:I believe the leading
/here isn't intended as that shouldn't be part of the documentation of the function.