-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
The following example gives a wrong error message:
fn main() {
let f = foo.map(|a| a as Foo::<Bar>);
}error: expected identifier, found `<`
--> b.rs:2:35
|
2 | let f = foo.map(|a| a as Foo::<Bar>);
| ^
error: chained comparison operators require parentheses
--> b.rs:2:35
|
2 | let f = foo.map(|a| a as Foo::<Bar>);
| ^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
error: expected expression, found `)`
--> b.rs:2:40
|
2 | let f = foo.map(|a| a as Foo::<Bar>);
| ^
error: aborting due to 4 previous errorsThe help: use ::<...>instead of<...>`` bit is wrong and suggests the opposite of the fix.
Note that none of the following give that error message:
fn main() {
let g = a as Foo::<Bar>;
}gives
error: expected identifier, found `<`
--> b.rs:2:23
|
2 | let g = a as Foo::<Bar>;
| ^
error: aborting due to previous errorand
fn main() {
let g: Foo::<Bar>;
}gives
error: expected identifier, found `<`
--> b.rs:2:17
|
2 | let g: Foo::<Bar>;
| ^
error: aborting due to previous errorwhich are correct but could be more explicit about the problem.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints