Closed
Description
Follow-up from this comment: #104422 (comment)
Given the following code:
fn main() {
1i32.MAX()
}
The current output is:
error[E0599]: no method named `MAX` found for type `i32` in the current scope
--> src/main.rs:2:10
|
2 | 1i32.MAX()
| -----^^^--
| | |
| | this is an associated function, not a method
| help: use associated function syntax instead: `i32::MAX()`
|
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
= note: the candidate is defined in an impl for the type `i32`
For more information about this error, try `rustc --explain E0599`.
Ideally the output should not mention i32::MAX()
, since that is an associated constant and not an associated function. However, it seems like some parts of method probing don't consider the associate item's kind when collecting candidates for diagnostics.
This should be investigated and fixed. While investigating, similar code should also be inspected and fixed if this can be triggered in other ways, for example.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A structured suggestion resulting in incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.