-
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 lintsT-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
Code
trait Trait {}
impl<T ?Sized> Trait for T {}
Current output
error: invalid `?` in type
--> src/lib.rs:3:8
|
3 | impl<T ?Sized> Trait for T {}
| ^ `?` is only allowed on expressions, not types
|
help: if you meant to express that the type might not contain a value, use the `Option` wrapper type
|
3 | impl<Option<T >Sized> Trait for T {}
| +++++++ ~
error: expected one of `>` or `as`, found `Sized`
--> src/lib.rs:3:9
|
3 | impl<T ?Sized> Trait for T {}
| ^^^^^ expected one of `>` or `as`
Desired output
It should suggest adding a `:` and not emit the two current errors, explaining that you forgot to write `:` before the `?Sized` bound.
Rationale and extra context
No response
Other cases
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.