Skip to content

Type inference is wrong with index accesses like .0.0 #11670

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

Closed
azrsh opened this issue Mar 10, 2022 · 2 comments
Closed

Type inference is wrong with index accesses like .0.0 #11670

azrsh opened this issue Mar 10, 2022 · 2 comments
Labels
A-parser parser issues A-ty type system / type inference / traits / method resolution E-unknown It's unclear if the issue is E-hard or E-easy without digging in

Comments

@azrsh
Copy link

azrsh commented Mar 10, 2022

rust-analyzer version: 5fae65d 2022-03-07 stable

rustc version: rustc 1.59.0 (9d1b2106e 2022-02-23)

relevant settings: none

The sample code is as follows.
item should be inferred to be of type i32, but it is not.

fn main() {
    let tupple = ((1, 2, 3), 2, 3);
    let item = tupple.0.0;
    let item_assert: i32 = item;
    
    println!("{}", item_assert );
}

image

@Veykril
Copy link
Member

Veykril commented Mar 10, 2022

cc #1109

@Veykril Veykril added A-parser parser issues A-ty type system / type inference / traits / method resolution E-unknown It's unclear if the issue is E-hard or E-easy without digging in labels Mar 10, 2022
@flodiebold
Copy link
Member

If it's not a duplicate of that, there's also #10560. So no reason to keep this one open as well, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser parser issues A-ty type system / type inference / traits / method resolution E-unknown It's unclear if the issue is E-hard or E-easy without digging in
Projects
None yet
Development

No branches or pull requests

3 participants