Skip to content

E0121 hint has duplicated type param with lifetime #79605

Closed
@l4l

Description

@l4l

The following code:

struct X<'a, T>(&'a T);

impl X<'_, _> {}

leads to the following error (tested at playground with 1.48 stable & 1.50 nightly):

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> src/lib.rs:3:12
  |
3 | impl X<'_, _> {}
  |            ^ not allowed in type signatures
  |
help: use type parameters instead
  |
3 | impl X<'_, T, T> {}
  |          ^^^  ^

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.T-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