-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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
Code
fn main() {
Default::default() == 1i32;
}
Current output
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> src/main.rs:2:5
|
2 | Default::default() == 1i32;
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
help: use a fully-qualified path to a specific available implementation (273 found)
|
2 | <&OsStr as Default>::default() == 1i32;
| ++++++++++ +
Desired output
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> src/main.rs:2:5
|
2 | Default::default() == 1i32;
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
help: use a fully-qualified path to a specific available implementation (273 found)
|
2 | </* self type */ as Default>::default() == 1i32;
| ++++++++++++++++++++ +
Rationale and extra context
if there are 273 possible self types to specify diagnostics should probably not arbitrarily decide what self type i meant since it actually has no idea.
Other cases
No response
Anything else?
Ideally it'd probably actually suggest i32::default()
but it might be unreasonable to expect diagnostics to figure that out
compiler-errors, Noratrieb, jonas-schievink, fmease, PatchMixolydic and 1 more
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.