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

Nested tuples {unknown} #12675

Closed
danielhuang opened this issue Jul 1, 2022 · 12 comments · Fixed by #12745
Closed

Nested tuples {unknown} #12675

danielhuang opened this issue Jul 1, 2022 · 12 comments · Fixed by #12745
Labels
A-macro macro expansion A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@danielhuang
Copy link

rust-analyzer version: rust-analyzer version: 0.0.0 (3410102 2022-06-30) (built locally)

also occurs on https://ra-wasm.netlify.app/

rustc version: rustc 1.64.0-nightly (7425fb293 2022-06-30)


Given the following code:

use std::collections::HashMap;

fn main() {
    let map: HashMap<_, _> = [((1, 2), 3), ((4, 5), 6)].into_iter().collect();
}

rust-analyzer reports:
image

@Veykril Veykril added the A-ty type system / type inference / traits / method resolution label Jul 2, 2022
@flodiebold flodiebold added the C-bug Category: bug label Jul 2, 2022
@flodiebold
Copy link
Member

Seems we don't consider tuples as implementing Eq (or PartialEq or PartialOrd or possibly more); e.g. (1i32,).eq() does not get resolved. (The HashMap FromIterator impl requires Eq for the key.) Probably we have some problem expanding the macro defining these impls?

@flodiebold flodiebold added the A-macro macro expansion label Jul 3, 2022
@flodiebold
Copy link
Member

Seems we don't like these repeats:

                $( ${ignore(T)} self.${index()} == other.${index()} )&&+

@Veykril
Copy link
Member

Veykril commented Jul 3, 2022

cc #11952

@bitgaoshu
Copy link
Contributor

bitgaoshu commented Jul 5, 2022

i think the issue may be about edition. if use 2021, map type is <(i32,i32),i32>. under is unkown. if use before 2021 edition, cloned after into_iter, it’s ok too. May relate to feature array_into_iter_impl.

@flodiebold
Copy link
Member

I'm pretty sure it's reproducible in 2021 as well, and caused by the above macro (at least).

@bitgaoshu
Copy link
Contributor

yeah, my ra is too old

@bitgaoshu
Copy link
Contributor

i try again. it’s true if change to 2021, it show unkown. but when ra reindex end, add or del some blank line, it changed.

@bitgaoshu
Copy link
Contributor

The pic shows what I said. sth wrong?
未命名

@flodiebold
Copy link
Member

Are you using the current Rust version?

@bitgaoshu
Copy link
Contributor

rustc 1.61.0 2022 05 18 stable

@flodiebold
Copy link
Member

I'm using 1.62. This is likely a recent regression.

@c410-f3r
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants