-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
In the provided code-snippet, store
is diagnosed as an unused variable by rust-analyzer, but not by rustc.
rust-analyzer version: 0.4.2543-standalone (f73ce3c 2025-07-17)
rustc version: rustc 1.89.0-nightly (99e7c15 2025-06-01)
editor or extension: VSCode
repository link (if public, optional): (eg. rust-analyzer)
code snippet to reproduce:
use std::any::Any;
fn main() {
let store = make();
// ^^^^^ unused-variable
bar(|| foo(store));
// bar(|| drop(store)) // does not reproduce here.
// foo(store) // does not reproduce here, either.
}
fn foo(_: Box<dyn Any>) {}
fn bar(_: impl FnOnce()) {}
fn make() -> Box<dyn Any> {
loop {}
}