Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic parameter reordering diagnostic doesn't contain bounds #59508

Closed
varkor opened this issue Mar 28, 2019 · 2 comments
Closed

Generic parameter reordering diagnostic doesn't contain bounds #59508

varkor opened this issue Mar 28, 2019 · 2 comments
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@varkor
Copy link
Member

varkor commented Mar 28, 2019

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>`
@varkor varkor added A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Mar 28, 2019
@Centril Centril added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. I-nominated labels Mar 29, 2019
@varkor
Copy link
Member Author

varkor commented Mar 29, 2019

It should also probably not contain the phrase , then consts if const generics aren't enabled.

@davidtwco
Copy link
Member

Submitted #59572 to address this.

Centril added a commit to Centril/rust that referenced this issue Mar 31, 2019
Include bounds in generic re-ordering diagnostic

Fixes rust-lang#59508.

r? @estebank
cc @varkor
Centril added a commit to Centril/rust that referenced this issue Mar 31, 2019
Include bounds in generic re-ordering diagnostic

Fixes rust-lang#59508.

r? @estebank
cc @varkor
Centril added a commit to Centril/rust that referenced this issue Mar 31, 2019
Include bounds in generic re-ordering diagnostic

Fixes rust-lang#59508.

r? @estebank
cc @varkor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants