-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Suggest Trait<Ty: Trait2> syntax when user typed Trait<Ty = Trait2> #105056
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`F-associated_type_bounds`#![feature(associated_type_bounds)]``#![feature(associated_type_bounds)]`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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`F-associated_type_bounds`#![feature(associated_type_bounds)]``#![feature(associated_type_bounds)]`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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Consider the following code:
The current output is:
This is reasonable especially in light of the ongoing migration from the old
dyn-less trait object syntax. However, an alternative interpretation of the syntax error is that the user accidentally used a type equality bound=when they actually meant a trait bound:. The error message could include a suggestion to replace=with:.See also related #99304 which proposes that
impl Fooshould be suggested rather thandyn Foo.