Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nvzqz opened this issue May 5, 2024 · 4 comments
Closed

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

nvzqz opened this issue May 5, 2024 · 4 comments
Labels
A-completion autocompletion A-proc-macro proc macro C-bug Category: bug

Comments

@nvzqz
Copy link

nvzqz commented May 5, 2024

rust-analyzer version: 0.3.1940-standalone (f216be4 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)()
    }
}
@nvzqz nvzqz added the C-bug Category: bug label May 5, 2024
@Veykril
Copy link
Member

Veykril commented May 5, 2024

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

@Veykril Veykril added the A-completion autocompletion label May 5, 2024
@alshdavid

This comment was marked as off-topic.

@davidbarsky
Copy link
Contributor

I also thought it might be related to #16555, but I don't think it is. I commented out out the trait_candidates.retain block and only got .counter suggested. It might be something else.

@Veykril Veykril added the A-proc-macro proc macro label May 21, 2024
@Veykril
Copy link
Member

Veykril commented Aug 27, 2024

This seems to work again now, why? I don't know but there have been a few fixes to both method search and trait bound constructions so likely something in there fixed this

@Veykril Veykril closed this as completed Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion A-proc-macro proc macro C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants