Skip to content

Confusing error message with “^^unexpected lifetime argument” pointing to non-lifetime argument. #71563

Closed
@steffahn

Description

@steffahn
type Foo<'a, T> = &'a T;

struct Bar;

fn foo() {
    let x: Foo<'static, Bar, 'static>;
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error[E0107]: wrong number of lifetime arguments: expected 1, found 2
 --> src/lib.rs:6:25
  |
6 |     let x: Foo<'static, Bar, 'static>;
  |                         ^^^ unexpected lifetime argument

error: aborting due to previous error

For more information about this error, try `rustc --explain E0107`.
error: could not compile `playground`.

To learn more, run the command again with --verbose.

@rustbot modify labels: A-diagnostics, D-confusing, T-compiler, D-papercut, C-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-papercutDiagnostics: An error or lint that needs small tweaks.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