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

type-mismatch false positive on unsizing coercion #13864

Open
jDomantas opened this issue Dec 30, 2022 · 1 comment
Open

type-mismatch false positive on unsizing coercion #13864

jDomantas opened this issue Dec 30, 2022 · 1 comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug S-unactionable Issue requires feedback, design decisions or is blocked on other work

Comments

@jDomantas
Copy link
Contributor

rust-analyzer version: rust-analyzer version: 0.3.1334-standalone (74ae2dd 2022-12-25)

rustc version: rustc 1.66.0 (69f9c33d7 2022-12-12)

relevant settings: in vscode's settings.json: "rust-analyzer.diagnostics.experimental.enable": true, "rust-analyzer.checkOnSave.enable": false (to opt-in into type checking diagnostics)

This code:

struct Foo<T: ?Sized> {
    leading: u32,
    trailing: T,
}

fn unsize(x: Box<Foo<[u32; 4]>>) -> Box<Foo<[u32]>> {
    x
}

compiles fine with rustc, but vscode shows type error from rust-analyzer:

image

@lnicola lnicola added A-ty type system / type inference / traits / method resolution S-actionable Someone could pick this issue up and work on it right now C-bug Category: bug labels Dec 30, 2022
@lowr
Copy link
Contributor

lowr commented Dec 30, 2022

The cause of this bug boils down to this FIXME. #13112 implements it and would resolve this, but it's blocked on another issue.

@lowr lowr added S-unactionable Issue requires feedback, design decisions or is blocked on other work and removed S-actionable Someone could pick this issue up and work on it right now labels Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug S-unactionable Issue requires feedback, design decisions or is blocked on other work
Projects
None yet
Development

No branches or pull requests

3 participants