Open
Description
When encountering an enum variant instance in a return type, make a better effort to suggest appropriate code.
Right now, if you accidentally write Some(Span)
when you meant Option<Span>
, we mention the existence of the enum, but we don't suggest code:
error[E0573]: expected type, found variant `Some`
--> src/librustc_typeck/check/mod.rs:5198:10
|
5198 | ) -> Some(Span) {
| ^^^^^^^^^^ not a type
|
= help: there is an enum variant `rustc::middle::cstore::LibSource::Some`, try using `rustc::middle::cstore::LibSource`?
= help: there is an enum variant `rustc::session::config::Passes::Some`, try using `rustc::session::config::Passes`?
= help: there is an enum variant `std::prelude::v1::Option::Some`, try using `std::prelude::v1::Option`?
= help: there is an enum variant `std::prelude::v1::Some`, try using `std::prelude::v1`?
It'd be nice if we could suggest the appropriate code.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Diagnostics: A structured suggestion resulting in incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.