-
Couldn't load subscription status.
- Fork 13.9k
Description
I have thought this is odd for a while, however after teaching a Rust introduction class I found numerous attendees stumbling on this weird error for a simple and common case.
error[E0308]: mismatched types
--> src/codelab.rs:100:5
|
100 | tail.val
| ^^^^^^^^ expected enum `std::option::Option`, found type parameter
|
= note: expected type `std::option::Option<T>`
= note: found type `T`The "found type parameter" part is confusing, as I (and most students) interpret this as some sort of weird syntax-like error. For example it feels similar to the "expected {, found ;" you get from syntax errors.
I think that simply adding `T` after the message would make this much more understandable.
error[E0308]: mismatched types
--> src/codelab.rs:100:5
|
100 | tail.val
| ^^^^^^^^ expected enum `std::option::Option`, found type parameter `T`
|
= note: expected type `std::option::Option<T>`
= note: found type `T`Possibly more controversial is dropping "parameter" or "type parameter" I don't think they add much value to the error message.
This issue has been assigned to @dkadashev via this comment.