-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
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`D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.P-lowLow priorityLow priorityT-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
Given code like cos(3.3);
where cos
is a method of f64
, we currently look for free functions elsewhere in the dependency tree:
error[E0425]: cannot find function `cos` in this scope
--> src/main.rs:2:13
|
2 | let _ = cos(3.3);
| ^^^ not found in this scope
|
help: consider importing this function
|
1 | use libm::cos;
|
But we should also check for existence of methods under that name for its sole argument.
error[E0425]: cannot find function `cos` in this scope
--> src/main.rs:2:13
|
2 | let _ = cos(3.3);
| ^^^ not found in this scope
|
help: you might have meant to call method `f64::cos`
|
2 | let _ = 3.3.cos();
| ~~~~~~~~~
peter9477, Artemis21, bindsdev, jruderman, ozkriff and 16 more
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`D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.P-lowLow priorityLow priorityT-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.