Skip to content

Commit 4e2a25d

Browse files
authored
Rollup merge of #75938 - Amjad50:min_const_generics-tests-revisions, r=lcnr
Added some `min_const_generics` revisions into `const_generics` tests Help in #75279. still a lot more to cover though r? @lcnr
2 parents 3b4797c + 668f63d commit 4e2a25d

File tree

107 files changed

+762
-375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+762
-375
lines changed

src/test/ui/const-generics/argument_order.stderr renamed to src/test/ui/const-generics/argument_order.full.stderr

Lines changed: 2 additions & 2 deletions
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/argument_order.rs:9:32
2+
--> $DIR/argument_order.rs:12:32
33
|
44
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
55
| -----------------^^-----^^-------------------- 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:16:23
8+
--> $DIR/argument_order.rs:20:23
99
|
1010
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
1111
| ^^^^^^^
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error: type parameters must be declared prior to const parameters
2+
--> $DIR/argument_order.rs:6:28
3+
|
4+
LL | struct Bad<const N: usize, T> {
5+
| -----------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const N: usize>`
6+
7+
error: lifetime parameters must be declared prior to const parameters
8+
--> $DIR/argument_order.rs:12: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:12: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+
19+
error[E0747]: lifetime provided when a type was expected
20+
--> $DIR/argument_order.rs:20:23
21+
|
22+
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
23+
| ^^^^^^^
24+
|
25+
= note: lifetime arguments must be provided before type arguments
26+
= help: reorder the arguments: lifetimes, then types, then consts: `<'a, 'b, T, U, N, M>`
27+
28+
error: aborting due to 4 previous errors
29+
30+
For more information about this error, try `rustc --explain E0747`.

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
#![feature(const_generics)]
2-
#![allow(incomplete_features)]
1+
// revisions: full min
2+
#![cfg_attr(full, feature(const_generics))]
3+
#![cfg_attr(full, allow(incomplete_features))]
4+
#![cfg_attr(min, feature(min_const_generics))]
35

46
struct Bad<const N: usize, T> {
7+
//[min]~^ ERROR type parameters must be declared prior to const parameters
58
arr: [u8; { N }],
69
another: T,
710
}
811

912
struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
1013
//~^ ERROR lifetime parameters must be declared prior
14+
//[min]~^^ ERROR type parameters must be declared prior to const parameters
1115
a: &'a T,
1216
b: &'b U,
1317
}

src/test/ui/const-generics/array-wrapper-struct-ctor.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// run-pass
2-
3-
#![feature(const_generics)]
4-
//~^ WARN the feature `const_generics` is incomplete
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))]
4+
#![cfg_attr(full, allow(incomplete_features))]
5+
#![cfg_attr(min, feature(min_const_generics))]
56

67
#![allow(dead_code)]
78

src/test/ui/const-generics/array-wrapper-struct-ctor.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/test/ui/const-generics/cannot-infer-type-for-const-param.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// check-pass
2-
#![feature(const_generics)]
3-
//~^ WARN the feature `const_generics` is incomplete
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))]
4+
#![cfg_attr(full, allow(incomplete_features))]
5+
#![cfg_attr(min, feature(min_const_generics))]
46

57
// This test confirms that the types can be inferred correctly for this example with const
68
// generics. Previously this would ICE, and more recently error.

src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/test/ui/const-generics/const-arg-type-arg-misordered.stderr renamed to src/test/ui/const-generics/const-arg-type-arg-misordered.full.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0747]: constant provided when a type was expected
2-
--> $DIR/const-arg-type-arg-misordered.rs:6:35
2+
--> $DIR/const-arg-type-arg-misordered.rs:8:35
33
|
44
LL | fn foo<const N: usize>() -> Array<N, ()> {
55
| ^
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0747]: constant provided when a type was expected
2+
--> $DIR/const-arg-type-arg-misordered.rs:8:35
3+
|
4+
LL | fn foo<const N: usize>() -> Array<N, ()> {
5+
| ^
6+
|
7+
= note: type arguments must be provided before constant arguments
8+
= help: reorder the arguments: types, then consts: `<T, N>`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0747`.

src/test/ui/const-generics/const-arg-type-arg-misordered.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
#![feature(const_generics)]
2-
#![allow(incomplete_features)]
1+
// revisions: full min
2+
#![cfg_attr(full, feature(const_generics))]
3+
#![cfg_attr(full, allow(incomplete_features))]
4+
#![cfg_attr(min, feature(min_const_generics))]
35

46
type Array<T, const N: usize> = [T; N];
57

6-
fn foo<const N: usize>() -> Array<N, ()> { //~ ERROR constant provided when a type was expected
8+
fn foo<const N: usize>() -> Array<N, ()> {
9+
//~^ ERROR constant provided when a type was expected
710
unimplemented!()
811
}
912

0 commit comments

Comments
 (0)