- Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I’m using rustc 1.33.0-nightly (a2b0f247b 2018-12-30)
.
trait MyTrait { type Item; } struct MyStruct<T> { item: T } impl<T> MyTrait for MyStruct<T> { type Item = T; } fn func<T: MyTrait<Item=i32>>(t: T) { } fn main() { func(MyStruct { item: "str" }); }
func
expects an MyTrait<Item=i32>
, so the error message should say: “expected type i32
, found type &str
.” Instead, they’re interchanged and it says:
error[E0271]: type mismatch resolving `<MyStruct<&str> as MyTrait>::Item == i32` --> src/main.rs:17:5 | 17 | func(my_struct); | ^^^^ expected &str, found i32 | = note: expected type `&str` found type `i32` note: required by `func` --> src/main.rs:13:1 | 13 | fn func<T: MyTrait<Item=i32>>(t: T) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.