Skip to content

Commit d39cc45

Browse files
committed
Added a lot of min_const_generics revisions
1 parent bf43421 commit d39cc45

File tree

73 files changed

+575
-236
lines changed

Some content is hidden

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

73 files changed

+575
-236
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:21: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:21: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`.
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
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> {
10-
//~^ ERROR lifetime parameters must be declared prior
13+
//[full]~^ ERROR lifetime parameters must be declared prior
14+
//[min]~^^ ERROR lifetime parameters must be declared prior to const parameters
15+
//[min]~^^^ ERROR type parameters must be declared prior to const parameters
1116
a: &'a T,
1217
b: &'b U,
1318
}
1419

1520
fn main() {
1621
let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
17-
//~^ ERROR lifetime provided when a type was expected
22+
//[full]~^ ERROR lifetime provided when a type was expected
23+
//[min]~^^ ERROR lifetime provided when a type was expected
1824
}

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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
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+
//[full]~^ ERROR constant provided when a type was expected
10+
//[min]~^^ ERROR constant provided when a type was expected
711
unimplemented!()
812
}
913

src/test/ui/const-generics/const-param-before-other-params.stderr renamed to src/test/ui/const-generics/const-param-before-other-params.full.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime parameters must be declared prior to const parameters
2-
--> $DIR/const-param-before-other-params.rs:4:21
2+
--> $DIR/const-param-before-other-params.rs:6:21
33
|
44
LL | fn bar<const X: (), 'a>(_: &'a ()) {
55
| --------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const X: ()>`
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
error: lifetime parameters must be declared prior to const parameters
2+
--> $DIR/const-param-before-other-params.rs:6:21
3+
|
4+
LL | fn bar<const X: (), 'a>(_: &'a ()) {
5+
| --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>`
6+
7+
error: type parameters must be declared prior to const parameters
8+
--> $DIR/const-param-before-other-params.rs:12:21
9+
|
10+
LL | fn foo<const X: (), T>(_: &T) {}
11+
| --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>`
12+
13+
error: `()` is forbidden as the type of a const generic parameter
14+
--> $DIR/const-param-before-other-params.rs:6:17
15+
|
16+
LL | fn bar<const X: (), 'a>(_: &'a ()) {
17+
| ^^
18+
|
19+
= note: the only supported types are integers, `bool` and `char`
20+
= note: more complex types are supported with `#[feature(const_generics)]`
21+
22+
error: `()` is forbidden as the type of a const generic parameter
23+
--> $DIR/const-param-before-other-params.rs:12:17
24+
|
25+
LL | fn foo<const X: (), T>(_: &T) {}
26+
| ^^
27+
|
28+
= note: the only supported types are integers, `bool` and `char`
29+
= note: more complex types are supported with `#[feature(const_generics)]`
30+
31+
error: aborting due to 4 previous errors
32+
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
#![allow(incomplete_features)]
2-
#![feature(const_generics)]
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
fn bar<const X: (), 'a>(_: &'a ()) {
5-
//~^ ERROR lifetime parameters must be declared prior to const parameters
7+
//[full]~^ ERROR lifetime parameters must be declared prior to const parameters
8+
//[min]~^^ ERROR lifetime parameters must be declared prior to const parameters
9+
//[min]~^^^ ERROR `()` is forbidden as the type of a const generic parameter
610
}
711

812
fn foo<const X: (), T>(_: &T) {}
13+
//[min]~^ ERROR type parameters must be declared prior to const parameters
14+
//[min]~^^ ERROR `()` is forbidden as the type of a const generic parameter
915

1016
fn main() {}

src/test/ui/const-generics/issues/issue-71381.stderr renamed to src/test/ui/const-generics/issues/issue-71381.full.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error[E0770]: the type of const parameters must not depend on other generic parameters
2-
--> $DIR/issue-71381.rs:13:82
2+
--> $DIR/issue-71381.rs:15:82
33
|
44
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
55
| ^^^^ the type must not depend on the parameter `Args`
66

77
error[E0770]: the type of const parameters must not depend on other generic parameters
8-
--> $DIR/issue-71381.rs:22:40
8+
--> $DIR/issue-71381.rs:26:40
99
|
1010
LL | const FN: unsafe extern "C" fn(Args),
1111
| ^^^^ the type must not depend on the parameter `Args`
1212

1313
error: using function pointers as const generic parameters is forbidden
14-
--> $DIR/issue-71381.rs:13:61
14+
--> $DIR/issue-71381.rs:15:61
1515
|
1616
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error: using function pointers as const generic parameters is forbidden
20-
--> $DIR/issue-71381.rs:22:19
20+
--> $DIR/issue-71381.rs:26:19
2121
|
2222
LL | const FN: unsafe extern "C" fn(Args),
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error[E0770]: the type of const parameters must not depend on other generic parameters
2+
--> $DIR/issue-71381.rs:15:82
3+
|
4+
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
5+
| ^^^^ the type must not depend on the parameter `Args`
6+
7+
error[E0770]: the type of const parameters must not depend on other generic parameters
8+
--> $DIR/issue-71381.rs:26:40
9+
|
10+
LL | const FN: unsafe extern "C" fn(Args),
11+
| ^^^^ the type must not depend on the parameter `Args`
12+
13+
error: using function pointers as const generic parameters is forbidden
14+
--> $DIR/issue-71381.rs:15:61
15+
|
16+
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
19+
error: using function pointers as const generic parameters is forbidden
20+
--> $DIR/issue-71381.rs:26:19
21+
|
22+
LL | const FN: unsafe extern "C" fn(Args),
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+
error: aborting due to 4 previous errors
26+
27+
For more information about this error, try `rustc --explain E0770`.

src/test/ui/const-generics/issues/issue-71381.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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 Test(*const usize);
57

@@ -11,17 +13,21 @@ unsafe extern "C" fn pass(args: PassArg) {
1113

1214
impl Test {
1315
pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
14-
//~^ ERROR: using function pointers as const generic parameters is forbidden
15-
//~| ERROR: the type of const parameters must not depend on other generic parameters
16+
//[full]~^ ERROR: using function pointers as const generic parameters is forbidden
17+
//[full]~| ERROR: the type of const parameters must not depend on other generic parameters
18+
//[min]~^^^ ERROR: using function pointers as const generic parameters is forbidden
19+
//[min]~| ERROR: the type of const parameters must not depend on other generic parameters
1620
self.0 = Self::trampiline::<Args, IDX, FN> as _
1721
}
1822

1923
unsafe extern "C" fn trampiline<
2024
Args: Sized,
2125
const IDX: usize,
2226
const FN: unsafe extern "C" fn(Args),
23-
//~^ ERROR: using function pointers as const generic parameters is forbidden
24-
//~| ERROR: the type of const parameters must not depend on other generic parameters
27+
//[full]~^ ERROR: using function pointers as const generic parameters is forbidden
28+
//[full]~| ERROR: the type of const parameters must not depend on other generic parameters
29+
//[min]~^^^ ERROR: using function pointers as const generic parameters is forbidden
30+
//[min]~| ERROR: the type of const parameters must not depend on other generic parameters
2531
>(
2632
args: Args,
2733
) {

src/test/ui/const-generics/issues/issue-71382.stderr renamed to src/test/ui/const-generics/issues/issue-71382.full.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: using function pointers as const generic parameters is forbidden
2-
--> $DIR/issue-71382.rs:15:23
2+
--> $DIR/issue-71382.rs:17:23
33
|
44
LL | fn test<const FN: fn()>(&self) {
55
| ^^^^
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: using function pointers as const generic parameters is forbidden
2+
--> $DIR/issue-71382.rs:17:23
3+
|
4+
LL | fn test<const FN: fn()>(&self) {
5+
| ^^^^
6+
7+
error: aborting due to previous error
8+

src/test/ui/const-generics/issues/issue-71382.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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 Test();
57

@@ -13,7 +15,8 @@ impl Test {
1315
}
1416

1517
fn test<const FN: fn()>(&self) {
16-
//~^ ERROR: using function pointers as const generic parameters is forbidden
18+
//[full]~^ ERROR: using function pointers as const generic parameters is forbidden
19+
//[min]~^^ ERROR: using function pointers as const generic parameters is forbidden
1720
FN();
1821
}
1922
}

src/test/ui/const-generics/issues/issue-71611.stderr renamed to src/test/ui/const-generics/issues/issue-71611.full.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0770]: the type of const parameters must not depend on other generic parameters
2-
--> $DIR/issue-71611.rs:4:31
2+
--> $DIR/issue-71611.rs:6:31
33
|
44
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
55
| ^ the type must not depend on the parameter `A`
66

77
error: using function pointers as const generic parameters is forbidden
8-
--> $DIR/issue-71611.rs:4:21
8+
--> $DIR/issue-71611.rs:6:21
99
|
1010
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
1111
| ^^^^^^^^^^^^
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0770]: the type of const parameters must not depend on other generic parameters
2+
--> $DIR/issue-71611.rs:6:31
3+
|
4+
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
5+
| ^ the type must not depend on the parameter `A`
6+
7+
error: using function pointers as const generic parameters is forbidden
8+
--> $DIR/issue-71611.rs:6:21
9+
|
10+
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
11+
| ^^^^^^^^^^^^
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0770`.

src/test/ui/const-generics/issues/issue-71611.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
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
fn func<A, const F: fn(inner: A)>(outer: A) {
5-
//~^ ERROR: using function pointers as const generic parameters is forbidden
6-
//~| ERROR: the type of const parameters must not depend on other generic parameters
7+
//[full]~^ ERROR: using function pointers as const generic parameters is forbidden
8+
//[full]~| ERROR: the type of const parameters must not depend on other generic parameters
9+
//[min]~^^^ ERROR: using function pointers as const generic parameters is forbidden
10+
//[min]~| ERROR: the type of const parameters must not depend on other generic parameters
711
F(outer);
812
}
913

0 commit comments

Comments
 (0)