Skip to content

Commit 36903d7

Browse files
committed
Add revisions to const generic default UI tests.
1 parent 2815db1 commit 36903d7

7 files changed

+64
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: type parameters must be declared prior to const parameters
2+
--> $DIR/complex-unord-param.rs:9:41
3+
|
4+
LL | struct NestedArrays<'a, const N: usize, A: 'a, const M: usize, T:'a =u32> {
5+
| ---------------------^----------------------^--------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, A: 'a, T: 'a, const N: usize, const M: usize>`
6+
7+
error: aborting due to previous error
8+

src/test/ui/const-generics/defaults/complex-unord-param.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
// run-pass
1+
// [full] run-pass
2+
// revisions: full min
23
// Checks a complicated usage of unordered params
3-
4-
#![feature(const_generics)]
5-
#![allow(incomplete_features)]
4+
#![cfg_attr(full, feature(const_generics))]
5+
#![cfg_attr(full, allow(incomplete_features))]
6+
#![cfg_attr(min, feature(min_const_generics))]
67
#![allow(dead_code)]
78

89
struct NestedArrays<'a, const N: usize, A: 'a, const M: usize, T:'a =u32> {
10+
//[min]~^ ERROR type parameters must be declared prior to const parameters
911
args: &'a [&'a [T; M]; N],
1012
specifier: A,
1113
}

src/test/ui/const-generics/defaults/intermixed-lifetime.stderr renamed to src/test/ui/const-generics/defaults/intermixed-lifetime.full.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: lifetime parameters must be declared prior to const parameters
2-
--> $DIR/intermixed-lifetime.rs:6:28
2+
--> $DIR/intermixed-lifetime.rs:7:28
33
|
44
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
55
| -----------------^^---------- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T>`
66

77
error: lifetime parameters must be declared prior to type parameters
8-
--> $DIR/intermixed-lifetime.rs:9:37
8+
--> $DIR/intermixed-lifetime.rs:11:37
99
|
1010
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T);
1111
| --------------------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T>`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: lifetime parameters must be declared prior to const parameters
2+
--> $DIR/intermixed-lifetime.rs:7:28
3+
|
4+
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
5+
| -----------------^^---------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
6+
7+
error: type parameters must be declared prior to const parameters
8+
--> $DIR/intermixed-lifetime.rs:7:32
9+
|
10+
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
11+
| ---------------------^------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
12+
13+
error: lifetime parameters must be declared prior to const parameters
14+
--> $DIR/intermixed-lifetime.rs:11:37
15+
|
16+
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T);
17+
| --------------------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
18+
19+
error: type parameters must be declared prior to const parameters
20+
--> $DIR/intermixed-lifetime.rs:11:28
21+
|
22+
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T);
23+
| -----------------^----------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
24+
25+
error: aborting due to 4 previous errors
26+
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
// revisions: full min
12
// Checks that lifetimes cannot be interspersed between consts and types.
2-
3-
#![feature(const_generics)]
4-
#![allow(incomplete_features)]
3+
#![cfg_attr(full, feature(const_generics))]
4+
#![cfg_attr(full, allow(incomplete_features))]
5+
#![cfg_attr(min, feature(min_const_generics))]
56

67
struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
78
//~^ Error lifetime parameters must be declared prior to const parameters
9+
//[min]~^^ Error type parameters must be declared prior to const parameters
810

911
struct Bar<const N: usize, T = u32, 'a>(&'a (), T);
10-
//~^ Error lifetime parameters must be declared prior to type parameters
12+
//[full]~^ Error lifetime parameters must be declared prior to type parameters
13+
//[min]~^^ Error type parameters must be declared prior to const parameters
14+
//[min]~| Error lifetime parameters must be declared prior to const parameters
1115

1216
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: type parameters must be declared prior to const parameters
2+
--> $DIR/simple-defaults.rs:9:40
3+
|
4+
LL | struct FixedOutput<'a, const N: usize, T=u32> {
5+
| ---------------------^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
6+
7+
error: aborting due to previous error
8+

src/test/ui/const-generics/defaults/simple-defaults.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
// run-pass
1+
// [full] run-pass
2+
// revisions: min full
23
// Checks some basic test cases for defaults.
3-
#![feature(const_generics)]
4-
#![allow(incomplete_features)]
4+
#![cfg_attr(full, feature(const_generics))]
5+
#![cfg_attr(full, allow(incomplete_features))]
6+
#![cfg_attr(min, feature(min_const_generics))]
57
#![allow(dead_code)]
68

79
struct FixedOutput<'a, const N: usize, T=u32> {
10+
//[min]~^ ERROR type parameters must be declared prior to const parameters
811
out: &'a [T; N],
912
}
1013

0 commit comments

Comments
 (0)