Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include bounds in generic reordering diagnostic.
This commit extends the existing generic re-ordering diagnostic to include any bounds on the generic parameter, thus producing correct suggestions.
- Loading branch information
Showing
4 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// run-rustfix | ||
|
||
#![allow(dead_code)] | ||
|
||
// This test checks that generic parameter re-ordering diagnostic suggestions contain bounds. | ||
|
||
struct A; | ||
|
||
impl A { | ||
pub fn do_things<'a, 'b: 'a, T>() { | ||
//~^ ERROR lifetime parameters must be declared prior to type parameters | ||
println!("panic"); | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// run-rustfix | ||
|
||
#![allow(dead_code)] | ||
|
||
// This test checks that generic parameter re-ordering diagnostic suggestions contain bounds. | ||
|
||
struct A; | ||
|
||
impl A { | ||
pub fn do_things<T, 'a, 'b: 'a>() { | ||
//~^ ERROR lifetime parameters must be declared prior to type parameters | ||
println!("panic"); | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: lifetime parameters must be declared prior to type parameters | ||
--> $DIR/issue-59508.rs:10:25 | ||
| | ||
LL | pub fn do_things<T, 'a, 'b: 'a>() { | ||
| ----^^--^^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b: 'a, T>` | ||
|
||
error: aborting due to previous error | ||
|