You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found a reproducible case where rust-analyzer returns a type mismatch error on code that compiles and runs correctly. (Caveat: I'm relatively new to the Rust ecosystem; equally, I can't see a case in which rustc and RA disagreeing about the type system isn't a bug!)
The offending code below is based on the example given in scan_fmt.
#[macro_use]externcrate scan_fmt;fnmain(){let word = scan_fmt!("hello","{}",String).unwrap();println!("{}", word);}
The "problems" tab in VS Code contains the following:
expected String, found &str rust-analyzer(type-mismatch) [Ln 5, Col 16]
expected String, found &str rust-analyzer(type-mismatch) [Ln 5, Col 16]
expected String, found &str rust-analyzer(type-mismatch) [Ln 5, Col 16]
By comparison, clippy doesn't raise any errors, and compiling and running the example works fine:
PS C:\[...]\ra-bug-report> cargo run --bin repro
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Running `target\debug\repro.exe`
hello
This appears to be another case of #11681; scan_fmt generates code that has two different err variables distinguished by hygiene, where one is a String and the other a &str.
rust-analyzer version: 0.3.1309-standalone (a2beeb8 2022-12-04); also affects pre-release v0.4.1314.
rustc version: rustc 1.65.0 (897e37553 2022-11-02)
relevant settings: None - I've used VSCode's rust-analyzer extension defaults everywhere, except for
I've found a reproducible case where rust-analyzer returns a type mismatch error on code that compiles and runs correctly. (Caveat: I'm relatively new to the Rust ecosystem; equally, I can't see a case in which rustc and RA disagreeing about the type system isn't a bug!)
The offending code below is based on the example given in scan_fmt.
The "problems" tab in VS Code contains the following:
By comparison, clippy doesn't raise any errors, and compiling and running the example works fine:
The RA error has the following verbose result:
The text was updated successfully, but these errors were encountered: