Closed
Description
As @mlesin reported, same problem is showing on latest versions (pre-release RA, vscode nightly) with
#[instrument]
Originally posted by @insilications in #14527
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
insilications commentedon May 21, 2025
Thanks for opening the issue. I think the issue could be more general when it comes to inlay hints. Some minimal reproduction showing how closure capture inlay hints disappear when the
#[instrument]
attribute macro is present:Using the latest Rustup nightlies. Happens if I use the
rust-analyzer 1.89.0-nightly (bc82152 2025-05-20)
binary directly, by using therust-analyzer.server.path
setting, or if I use the includedrust-analyzer
from the VS Code extension.VS Code Rust Analyzer version:
rust-lang.rust-analyzer-0.4.2468-linux-x64
VS Code:
Minimal reproduction:
Without

#[tracing::instrument]
:With

#[tracing::instrument]
:insilications commentedon May 21, 2025
If you need any extra logs/traces, please tell me how to enable such extra logs/traces from RA and its LSP.
ChayimFriedman2 commentedon May 21, 2025
Yes, they all have the same reason. I'm diagnosing it now.
insilications commentedon May 22, 2025
I tried https://github.com/rust-lang/rust-analyzer/releases/tag/nightly with the minimally reproducible example and the closure capture inlay hints are still gone. No errors in
rust-analyzer extension
andrust-analyzer Language Server
...Veykril commentedon May 22, 2025
The fix in #19839 is on the proc-macro server side. So you won't be able to observe it until its synced back to rust-lang/rust and published as the corresponding rustup componenet, or you build that component manually and point rust-analyzer to use the self-build one.
insilications commentedon May 22, 2025
@Veykril thanks for clarifying! I should have looked at which files were changed in the commit 😛
I will build it manually.
insilications commentedon May 25, 2025
For those waiting, it seems that the fix may land in the next nightly and available through
rustup
.ChayimFriedman2 commentedon May 25, 2025
@insilications Did you verify it works?
Anyway it will only be available for those using nightly toolchain. Those using stable toolchains will have to wait until the next Rust release.
insilications commentedon May 25, 2025
I decided to wait for it to drop in the next nightly toolchain in order to test it. Seems like it is very close to bring your changes into it (https://github.com/rust-lang/rust/commits/master/src/tools/rust-analyzer/crates/proc-macro-srv/src). I am being lazy, I could build it manually.
insilications commentedon Jun 8, 2025
@ChayimFriedman2 It seems it is still happening with the
nightly-x86_64-unknown-linux-gnu
(2025-06-07) toolchain.VS Code Rust Analyzer version:
rust-lang.rust-analyzer-0.4.2488-linux-x64
VS Code:
When removing
#[tracing::instrument]
or using the ignore options to ignore proc-macro analysis oftracing::instrument
in the proc-macro srv:It shows the correct closure capture inlay hints:

When I remove the ignore options, the closure capture inlay hints disappear:

ChayimFriedman2 commentedon Jun 8, 2025
@insilications I didn't check closure capture hints when analyzing this, and in fact now when analyzing them I see they will indeed not work (they don't descend into attributes). Can you check with chaining and parameter hints?
insilications commentedon Jun 8, 2025
@ChayimFriedman2
4 remaining items