rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
13.62k stars 1.49k forks source link

Conditional methods don't get suggested by Rust Analyzer #17189

Open nvzqz opened 1 week ago

nvzqz commented 1 week ago

rust-analyzer version: 0.3.1940-standalone (f216be4a0 2024-04-27)

rustc version:

rustc -Vv
rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: aarch64-apple-darwin
release: 1.77.2
LLVM version: 17.0.6

editor or extension: VSCode

code snippet to reproduce:

#[divan::bench]
fn my_benchmark(bencher: divan::Bencher) {
    bencher.bench(|| {/* ... */});
}

It used to be that methods like bench or with_inputs + bench_values would be suggested by Rust Analyzer. This no longer works.

Bencher uses a similar pattern to:

struct Container<A>(A);

impl<A: Fn()> Container<A> {
    fn invoke(&self) {
        (self.0)()
    }
}
Veykril commented 1 week ago

cc @davidbarsky I assume that this might be caused by your changes