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

Autocomplete/hover broken in IndexMap with tuple key #14871

Closed
jprochazk opened this issue May 22, 2023 · 1 comment · Fixed by #14878
Closed

Autocomplete/hover broken in IndexMap with tuple key #14871

jprochazk opened this issue May 22, 2023 · 1 comment · Fixed by #14878
Labels
A-macro macro expansion Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug

Comments

@jprochazk
Copy link
Contributor

jprochazk commented May 22, 2023

When hovering over retain in the following snippet, rust-analyzer does not display any tooltip.

use indexmap::IndexMap; // 1.9.3

fn main() {
    let mut map = IndexMap::<(usize, usize), usize>::new();
    map.retain(|_, _| true);
}

If the key is changed to just usize, it starts working again:

use indexmap::IndexMap; // 1.9.3

fn main() {
    let mut map = IndexMap::<usize, usize>::new();
    map.retain(|_, _| true);
}

std::collections::HashMap doesn't seem to have the same issue.

rust-analyzer version: rust-analyzer version: 0.3.1524-standalone

rustc version: rustc 1.71.0-nightly (77f4f828a 2023-05-20)

relevant settings: -

@jprochazk jprochazk added the C-bug Category: bug label May 22, 2023
@lowr
Copy link
Contributor

lowr commented May 22, 2023

This is... not nice. We're now failing to prove some basic trait references for tuples because they are implemented by this macro, which contains ${count(x)} metavariable expression on nightly that we haven't implemented yet (#11952). It was introduced in rust-lang/rust@4d04a06 as part of rust-lang/rust#97594.

In particular, we're failing to prove (usize, usize): PartialEq that's required by IndexMap::retain().

We have two options: implement ${count(x)} asap (before it lands on stable at the very least) or file a PR to revert that commit. I'll look into it in the coming days.

@lowr lowr added A-macro macro expansion Broken Window Bugs / technical debt to be addressed immediately labels May 22, 2023
@bors bors closed this as completed in 150082b May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants