rust-lang / rust-lang/rust-analyzer
Feature request: Option to show inlay hints for implicit `Drop` calls
Open
@jnyfah is already working on this.
Since Feb 7, 2025.
A-inlay-hints
C-feature
E-hard
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I feel like having an option to explicitly show any potentially implicit calls to Drop() would be a nice option to have.
For example, in a function like
fn foo(x: std::sync::Mutex<bool>) {
let xx = x.lock().unwrap();
*xx = !*xx;
// add an inlay hint here showing that xx gets dropped
}
it might be nice to be able to hover over something to see the Drop implementation for MutexGuard, and make it explicit (at least in the editor) where certain values are being dropped. (Which could also be helpful for rust beginners.) This is probably something that should only be done when the type has a non-trivial Drop impl, however.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.