Skip to content

Generic parameter reordering diagnostic doesn't contain bounds #59508

Closed
@varkor

Description

@varkor
struct A;

impl A {
    pub fn do_things<T, 'a, 'b: 'a>() {
        println!("panic");
    }
}

produces:

error: lifetime parameters must be declared prior to type parameters
 --> src/lib.rs:4:25
  |
4 |     pub fn do_things<T, 'a, 'b: 'a>() {
  |                     ----^^--^^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`

which should be:

error: lifetime parameters must be declared prior to type parameters
 --> src/lib.rs:4:25
  |
4 |     pub fn do_things<T, 'a, 'b: 'a>() {
  |                     ----^^--^^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b: 'a, T>`

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.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