Skip to content

Commit 9910f15

Browse files
committed
add more complex param order test
1 parent 6dc6a1f commit 9910f15

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/test/ui/const-generics/argument_order.rs

+7
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ struct Bad<const N: usize, T> { //~ ERROR type parameters must be declared prior
66
another: T,
77
}
88

9+
struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
10+
//~^ ERROR type parameters must be declared prior
11+
//~| ERROR lifetime parameters must be declared prior
12+
a: &'a T,
13+
b: &'b U,
14+
}
15+
916
fn main() { }

src/test/ui/const-generics/argument_order.stderr

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ error: type parameters must be declared prior to const parameters
44
LL | struct Bad<const N: usize, T> {
55
| -----------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const N: usize>`
66

7+
error: lifetime parameters must be declared prior to const parameters
8+
--> $DIR/argument_order.rs:9:32
9+
|
10+
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
11+
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
12+
13+
error: type parameters must be declared prior to const parameters
14+
--> $DIR/argument_order.rs:9:36
15+
|
16+
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
17+
| ---------------------^----------------------^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
18+
719
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
820
--> $DIR/argument_order.rs:1:12
921
|
@@ -13,5 +25,5 @@ LL | #![feature(const_generics)]
1325
= note: `#[warn(incomplete_features)]` on by default
1426
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
1527

16-
error: aborting due to previous error; 1 warning emitted
28+
error: aborting due to 3 previous errors; 1 warning emitted
1729

0 commit comments

Comments
 (0)