-
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-trait-systemArea: Trait systemArea: Trait systemD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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
Given the following code: playground
fn main() {
let x: i32 = 1;
println!("{:?}", x.count())
}
The current output is:
error[E0599]: the method `count` exists for type `i32`, but its trait bounds were not satisfied
--> src/main.rs:3:24
|
3 | println!("{:?}", x.count())
| ^^^^^ method cannot be called on `i32` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`i32: Iterator`
which is required by `&mut i32: Iterator`
error: aborting due to previous error
Ideally the output should look like:
error[E0599]: the method `count` does not exist for type `i32`
For some reason, this doesn't happen for all traits in std
. Eg
fn main() {
let x: i32 = 1;
println!("{:?}", x.write(&[1, 2, 3]))
}
Just gives
error[E0599]: no method named `write` found for type `i32` in the current scope
--> src/main.rs:3:24
|
3 | println!("{:?}", x.write(&[1, 2, 3]))
| ^^^^^ method not found in `i32`
error: aborting due to previous error
Version: 1.53.0-nightly (2021-04-22 7f4afdf)
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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.