Skip to content

Diagnostic for impl for S should also suggest syntax for inherit impl #88818

Closed
@jruderman

Description

@jruderman

Given the following code:

struct S { }
impl for S { }

The current output is:

error: missing trait in a trait impl
 --> src/lib.rs:2:5
  |
2 | impl for S { }
  |     ^

Ideally the output should look like:

help: to implement trait items for struct S, write `impl TraitName for S { ... }`
help: to implement inherit items for struct S, write `impl S { ... }`

Followup to #56031

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions