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

False positive E0308 with &dyn - Expected x, found y #15506

Closed
mladedav opened this issue Aug 23, 2023 · 3 comments
Closed

False positive E0308 with &dyn - Expected x, found y #15506

mladedav opened this issue Aug 23, 2023 · 3 comments
Labels
C-bug Category: bug

Comments

@mladedav
Copy link
Contributor

This compiles but creates a false positive expected &dyn Debug, found &i32

fn main() {
    let x: &dyn std::fmt::Debug = &0;
}

Interestingly, &str does not trigger the same behavior. I tried to dig deeper but wasn't able to find anything useful in the source.

rust-analyzer version: rust-analyzer version: 0.4.1633-standalone

rustc version: rustc 1.71.0 (8ede3aae2 2023-07-12)

@mladedav mladedav added the C-bug Category: bug label Aug 23, 2023
@mladedav
Copy link
Contributor Author

This looks similar to the error in the second checkbox in this comment but the repro it links to is working.

@lnicola
Copy link
Member

lnicola commented Aug 23, 2023

#11847

@mladedav
Copy link
Contributor Author

Sorry, didn't find that. Closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants