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

Odd types in mismatch #18115

Open
Veykril opened this issue Sep 15, 2024 · 4 comments
Open

Odd types in mismatch #18115

Veykril opened this issue Sep 15, 2024 · 4 comments
Labels
A-diagnostics diagnostics / error reporting A-ty type system / type inference / traits / method resolution C-enhancement Category: enhancement

Comments

@Veykril
Copy link
Member

Veykril commented Sep 15, 2024

fn t(
    parents: &[&()],
)  {}
   
fn a() {
    let x: ();
    t(&[x])
}

Just an observation which might be unactionable but the snippet above yields expected &[&()], found &[!; 1]rust-analyzer[E0308](https://doc.rust-lang.org/stable/error_codes/E0308.html). Notably the never type in there is odd. I'd expect &[(); 1] given we know the type of x.

@Veykril Veykril added A-ty type system / type inference / traits / method resolution A-diagnostics diagnostics / error reporting C-enhancement Category: enhancement labels Sep 15, 2024
@ChayimFriedman2
Copy link
Contributor

Can't reproduce. It gives me expected &(), found () (tip of git).

@Veykril
Copy link
Member Author

Veykril commented Sep 15, 2024

image
I get both :)

nightly-x86_64-pc-windows-msvc (default)
rustc 1.83.0-nightly (c2f74c3f9 2024-09-09)

and

rust-analyzer version: 0.4.2110-standalone (4221354a8 2024-09-13)

@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented Sep 15, 2024

I get only that :)

image

Both with tip-of-git and with stable rust-analyzer.

@Veykril
Copy link
Member Author

Veykril commented Sep 15, 2024

Well that is fun...

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

No branches or pull requests

2 participants