Open rbtcollins opened 1 year ago
Would you share the whole code base that this issue is occurring, or if it's not possible, can you try creating an MRE? It's pretty hard to track down the root cause of type mismatches without knowing all the types/impls/traits in scope, etc. Thanks!
First one is from rustup, but I can't reproduce because it's gated for Windows. Second looks like a feature branch, but I couldn't spot it.
Second one is from my branch https://github.com/rbtcollins/rustup.rs/tree/termcolor-tweaked
rust-analyzer version: rust-analyzer version: 0.3.1506-standalone (833d5301d 2023-05-07)
rustc version: rustc 1.70.0-beta.6 (2687f47c4 2023-05-26)
relevant settings:
The following code is returning type mismatches, yet cargo build and cargo clippy are happy.
The reported error is
expected &String, found String
You can see from the screenshot that it thinks
host_triple
is an &String, but it is actually a String. If I explicitly make it a string:let host_triple:String = ...
then the error goes away.I'm also getting another spurious type-mismatch here:
You can see from the embeds that RA thinks spec is a ColorSpec, but actually because of the deref_mut(), it is an &ColorSpec, and thus the error message
expected &ColorSpec, found ColorSpec
is nonsense.