-
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 lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Description
The snippet
fn main() {
let foo = "str";
println!("{}", foo.desc);
}
produces the two error messages
error: attempted access of field `desc` on type `&'static str`, but no field with that name was found
bug.rs:3 println!("{}", foo.desc);
^~~~~~~~
error: cannot determine a type for this bounded type parameter: unconstrained type
bug.rs:3 println!("{}", foo.desc);
^~~~~~~~
that are possibly separated by some notes from the compiler such that the first one is not directly visible.
The problem is, that the second message is absolutely not helpful and leads to confusion if the first one is overlooked. I get why the second message is issued but I don't think that it's relevant since the first error is the sole cause for the second error.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.