Closed
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.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint; hard to understand for new users.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.