Skip to content

unused param error mentions incorrect param if there's a misplaced lt param #83556

Closed
@lcnr

Description

@lcnr

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f6aaeef90ca703dffc311e3829186005

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

causes the following error:

error: lifetime parameters must be declared prior to type parameters
 --> src/lib.rs:1:15
  |
1 | struct Foo<T, 'a>(&'a ());
  |           ----^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T>`

error[E0392]: parameter `'a` is never used
 --> src/lib.rs:1:15
  |
1 | struct Foo<T, 'a>(&'a ());
  |               ^^ unused parameter
  |
  = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

it should be "parameter T is never used"

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.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