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 positives in rust-lang/rust: expected &dyn Display, found &i32 #14724

Closed
Zalathar opened this issue May 3, 2023 · 2 comments
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@Zalathar
Copy link
Contributor

Zalathar commented May 3, 2023

When I open the Rust compiler's compiler/rustc_mir_transform/src/coverage/debug.rs in VSCode with rust-analyzer, I see two type errors that don't appear when building normally at the command-line:

  • expected &dyn Display, found &i32 rust-analyzer (type-mismatch) [Ln 642, Col 68]
  • expected &dyn Display, found &i32 rust-analyzer (type-mismatch) [Ln 743, Col 67]

These appear to be false positives, since &i32 should convert to &dyn Display automatically.

I can work around the problem locally by manually changing the source code from &0 to &0 as _.


rust-analyzer version: 0.3.1498-standalone (3a27518 2023-04-30)

rustc version: Bootstrap compiler provided by x.py

relevant settings: Using the compiler's rust_analyzer_settings.json, modified with --build-dir=_build-rust-analyzer

@Zalathar Zalathar added the C-bug Category: bug label May 3, 2023
@lnicola lnicola added the A-ty type system / type inference / traits / method resolution label May 3, 2023
@lnicola
Copy link
Member

lnicola commented May 3, 2023

Duplicate of #11847

@lnicola lnicola marked this as a duplicate of #11847 May 3, 2023
@lnicola lnicola closed this as completed May 3, 2023
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
Projects
None yet
Development

No branches or pull requests

2 participants