False/Irrelevant Error E0277 #50333
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
On type mismatchses when using trait objects, rust emits error E0277, saying that the trait does not have a constant size known at compile-time, and that all local variables must have a statically known type. In fact, the problem lies elsewhere, and the program can be fixed without addressing the E0277 error at all.
I wrote this code:
The marked tuple has 2
A::new()
copies, when it should have 3. If this is fixed, the code compiles. I would expect to see a single error pointing out this fact. Instead, four errors are returned:Only the first of these errors is related to the bug - the other three are all false and/or irrelevant.
Meta
rustc --version --verbose
:rustc 1.25.0 (84203ca 2018-03-25)
binary: rustc
commit-hash: 84203ca
commit-date: 2018-03-25
host: x86_64-unknown-linux-gnu
release: 1.25.0
LLVM version: 6.0
Also produced on nightly 1.27.0
The text was updated successfully, but these errors were encountered: