Skip to content

Commit b92ed4e

Browse files
committed
reflect that type and const parameter can be intermixed
Also, add reference id
1 parent 292db4a commit b92ed4e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
struct Bad<const N: usize, T> {
1+
//@ reference: items.generics.syntax.decl-order
2+
3+
struct Good<const N: usize, T> {
24
arr: [u8; { N }],
35
another: T,
46
}
57

6-
struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
8+
struct Bad<const N: usize, 'a, T, 'b, const M: usize, U> {
79
//~^ ERROR lifetime parameters must be declared prior
810
a: &'a T,
911
b: &'b U,
1012
}
1113

1214
fn main() {
13-
let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
15+
let _: Bad<7, 'static, u32, 'static, 17, u16>;
1416
//~^ ERROR lifetime provided when a type was expected
1517
}

tests/ui/const-generics/argument_order.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error: lifetime parameters must be declared prior to type and const parameters
2-
--> $DIR/argument_order.rs:6:32
2+
--> $DIR/argument_order.rs:8:28
33
|
4-
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
5-
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>`
4+
LL | struct Bad<const N: usize, 'a, T, 'b, const M: usize, U> {
5+
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>`
66

77
error[E0747]: lifetime provided when a type was expected
8-
--> $DIR/argument_order.rs:13:23
8+
--> $DIR/argument_order.rs:15:19
99
|
10-
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
11-
| ^^^^^^^
10+
LL | let _: Bad<7, 'static, u32, 'static, 17, u16>;
11+
| ^^^^^^^
1212
|
1313
= note: lifetime arguments must be provided before type arguments
1414
= help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, N, T, M, U>`

0 commit comments

Comments
 (0)