Incorrect compiler error message on mismatched types #43420
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I ran
cargo build
with some code that did not compile due to a type mismatch, error E0308. Help text was displayed, which was false/very misleading.Here's a reduced test case:
After running
cargo build
, the error displayed was:Focusing in on the line: expected slice, found struct
std::vec::Vec
This is incorrect, because
std::vec::Vec
dereferences into slice. The actual type mismatch, which should have been displayed, is betweenu16
andu8
. I would expect the error to say:expected
u16
, foundu8
Meta:
I discovered this on nightly, but reproduced it on stable.
rustc --version --verbose
:rustc 1.19.0 (0ade339 2017-07-17)
binary: rustc
commit-hash: 0ade339
commit-date: 2017-07-17
host: x86_64-unknown-linux-gnu
release: 1.19.0
LLVM version: 4.0
The text was updated successfully, but these errors were encountered: