-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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
Hi,
I've got following code:
#[derive(Eq, PartialEq)]
pub struct Foo;
impl Foo {
fn new() -> Self { Foo }
}
fn main() {
if None == Foo::new() {
// ^^^^^^^^^^
// |
// expected enum `std::option::Option`, found struct `Foo`
// help: try using a variant of the expected type: `Some(<Foo>::new())`
}
}
The suggested <Foo>::new()
syntax is valid, but - quite frankly - spooky (and it seems to be this way from the very beginning of this feature). Could it suggest just Foo::new()
?
I'd like to tackle this myself, but I'd need at least a hint where to look :-)
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.