Skip to content

Commit d89d2a9

Browse files
committed
Added more min_const_generics revisions to tests
1 parent d39cc45 commit d89d2a9

34 files changed

+224
-157
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0741]: `&'static (dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
2+
--> $DIR/issue-63322-forbid-dyn.rs:10:18
3+
|
4+
LL | fn test<const T: &'static dyn A>() {
5+
| ^^^^^^^^^^^^^^ `&'static (dyn A + 'static)` doesn't derive both `PartialEq` and `Eq`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0741`.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: `&'static (dyn A + 'static)` is forbidden as the type of a const generic parameter
2+
--> $DIR/issue-63322-forbid-dyn.rs:10:18
3+
|
4+
LL | fn test<const T: &'static dyn A>() {
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: the only supported types are integers, `bool` and `char`
8+
= note: more complex types are supported with `#[feature(const_generics)]`
9+
10+
error[E0741]: `&'static (dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
11+
--> $DIR/issue-63322-forbid-dyn.rs:10:18
12+
|
13+
LL | fn test<const T: &'static dyn A>() {
14+
| ^^^^^^^^^^^^^^ `&'static (dyn A + 'static)` doesn't derive both `PartialEq` and `Eq`
15+
16+
error: aborting due to 2 previous errors
17+
18+
For more information about this error, try `rustc --explain E0741`.

src/test/ui/const-generics/issues/issue-63322-forbid-dyn.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
#![feature(const_generics)]
2-
//~^ WARN the feature `const_generics` is incomplete
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
trait A {}
57
struct B;
68
impl A for B {}
79

810
fn test<const T: &'static dyn A>() {
9-
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
11+
//[full]~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
12+
//[min]~^^ ERROR `&'static (dyn A + 'static)` is forbidden as the type of a const generic parameter
13+
//[min]~| ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
1014
unimplemented!()
1115
}
1216

src/test/ui/const-generics/issues/issue-63322-forbid-dyn.stderr

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: constant expression depends on a generic parameter
2-
--> $DIR/issue-64494.rs:14:53
2+
--> $DIR/issue-64494.rs:16:53
33
|
44
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
55
| ^^^^
66
|
77
= note: this may fail depending on what value the parameter takes
88

99
error: constant expression depends on a generic parameter
10-
--> $DIR/issue-64494.rs:16:53
10+
--> $DIR/issue-64494.rs:19:53
1111
|
1212
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
1313
| ^^^^
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error: generic parameters must not be used inside of non trivial constant values
2+
--> $DIR/issue-64494.rs:16:38
3+
|
4+
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
5+
| ^^^^^^ non-trivial anonymous constants must not depend on the parameter `T`
6+
|
7+
= help: it is currently only allowed to use either `T` or `{ T }` as generic constants
8+
9+
error: generic parameters must not be used inside of non trivial constant values
10+
--> $DIR/issue-64494.rs:19:38
11+
|
12+
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
13+
| ^^^^^^ non-trivial anonymous constants must not depend on the parameter `T`
14+
|
15+
= help: it is currently only allowed to use either `T` or `{ T }` as generic constants
16+
17+
error[E0119]: conflicting implementations of trait `MyTrait`:
18+
--> $DIR/issue-64494.rs:19:1
19+
|
20+
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
21+
| ------------------------------------ first implementation here
22+
...
23+
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
25+
26+
error: aborting due to 3 previous errors
27+
28+
For more information about this error, try `rustc --explain E0119`.

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

Lines changed: 9 additions & 4 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
trait Foo {
57
const VAL: usize;
@@ -12,8 +14,11 @@ struct Is<const T: bool>;
1214
impl True for Is<{true}> {}
1315

1416
impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
15-
//~^ ERROR constant expression depends on a generic parameter
17+
//[full]~^ ERROR constant expression depends on a generic parameter
18+
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
1619
impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
17-
//~^ ERROR constant expression depends on a generic parameter
20+
//[full]~^ ERROR constant expression depends on a generic parameter
21+
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
22+
//[min]~| ERROR conflicting implementations of trait `MyTrait`
1823

1924
fn main() {}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// check-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
struct Foo<const D: usize> {
78
state: Option<[u8; D]>,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: constant expression depends on a generic parameter
2+
--> $DIR/issue-66205.rs:8:12
3+
|
4+
LL | fact::<{ N - 1 }>();
5+
| ^^^^^^^^^
6+
|
7+
= note: this may fail depending on what value the parameter takes
8+
9+
error: aborting due to previous error
10+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: generic parameters must not be used inside of non trivial constant values
2+
--> $DIR/issue-66205.rs:8:14
3+
|
4+
LL | fact::<{ N - 1 }>();
5+
| ^ non-trivial anonymous constants must not depend on the parameter `N`
6+
|
7+
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
8+
9+
error: aborting due to previous error
10+
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
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))]
15
#![allow(dead_code, unconditional_recursion)]
2-
#![feature(const_generics)]
3-
//~^ WARN the feature `const_generics` is incomplete
46

57
fn fact<const N: usize>() {
68
fact::<{ N - 1 }>();
7-
//~^ ERROR constant expression depends on a generic parameter
9+
//[full]~^ ERROR constant expression depends on a generic parameter
10+
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
811
}
912

1013
fn main() {}

src/test/ui/const-generics/issues/issue-66205.stderr

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

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// check-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
pub struct Tuple;
78

src/test/ui/const-generics/issues/issue-66906.stderr

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

src/test/ui/const-generics/issues/issue-67185-1.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// check-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
trait Baz {
78
type Quaks;

src/test/ui/const-generics/issues/issue-67185-1.stderr

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

src/test/ui/const-generics/issues/issue-68596.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-
#![allow(incomplete_features)]
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
pub struct S(u8);
68

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: `[usize; 0]` is forbidden as the type of a const generic parameter
2+
--> $DIR/issue-68615-adt.rs:7:23
3+
|
4+
LL | struct Const<const V: [usize; 0]> {}
5+
| ^^^^^^^^^^
6+
|
7+
= note: the only supported types are integers, `bool` and `char`
8+
= note: more complex types are supported with `#[feature(const_generics)]`
9+
10+
error: aborting due to previous error
11+

src/test/ui/const-generics/issues/issue-68615-adt.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
// check-pass
2-
#![feature(const_generics)]
3-
#![allow(incomplete_features)]
1+
// [full] check-pass
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
struct Const<const V: [usize; 0]> {}
8+
//[min]~^ ERROR `[usize; 0]` is forbidden as the type of a const generic parameter
69
type MyConst = Const<{ [] }>;
710

811
fn main() {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: `[usize; 0]` is forbidden as the type of a const generic parameter
2+
--> $DIR/issue-68615-array.rs:7:21
3+
|
4+
LL | struct Foo<const V: [usize; 0] > {}
5+
| ^^^^^^^^^^
6+
|
7+
= note: the only supported types are integers, `bool` and `char`
8+
= note: more complex types are supported with `#[feature(const_generics)]`
9+
10+
error: aborting due to previous error
11+

src/test/ui/const-generics/issues/issue-68615-array.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
// check-pass
2-
#![feature(const_generics)]
3-
#![allow(incomplete_features)]
1+
// [full] check-pass
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
struct Foo<const V: [usize; 0] > {}
8+
//[min]~^ ERROR `[usize; 0]` is forbidden as the type of a const generic parameter
69

710
type MyFoo = Foo<{ [] }>;
811

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: constant expression depends on a generic parameter
2+
--> $DIR/issue-68977.rs:35:44
3+
|
4+
LL | FxpStorageHelper<INT_BITS, FRAC_BITS>: FxpStorage,
5+
| ^^^^^^^^^^
6+
|
7+
= note: this may fail depending on what value the parameter takes
8+
9+
error: aborting due to previous error
10+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: generic parameters must not be used inside of non trivial constant values
2+
--> $DIR/issue-68977.rs:29:17
3+
|
4+
LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
5+
| ^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `INT_BITS`
6+
|
7+
= help: it is currently only allowed to use either `INT_BITS` or `{ INT_BITS }` as generic constants
8+
9+
error: generic parameters must not be used inside of non trivial constant values
10+
--> $DIR/issue-68977.rs:29:28
11+
|
12+
LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
13+
| ^^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `FRAC_BITS`
14+
|
15+
= help: it is currently only allowed to use either `FRAC_BITS` or `{ FRAC_BITS }` as generic constants
16+
17+
error: aborting due to 2 previous errors
18+

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#![feature(const_generics)]
2-
//~^ WARN the feature `const_generics` is incomplete
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 PhantomU8<const X: u8>;
57

@@ -25,11 +27,13 @@ fxp_storage_impls! {
2527

2628
type FxpStorageHelper<const INT_BITS: u8, const FRAC_BITS: u8> =
2729
PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
30+
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
31+
//[min]~| ERROR generic parameters must not be used inside of non trivial constant values
2832

2933
struct Fxp<const INT_BITS: u8, const FRAC_BITS: u8>
3034
where
3135
FxpStorageHelper<INT_BITS, FRAC_BITS>: FxpStorage,
32-
//~^ ERROR constant expression depends on a generic parameter
36+
//[full]~^ ERROR constant expression depends on a generic parameter
3337
{
3438
storage: <FxpStorageHelper<INT_BITS, FRAC_BITS> as FxpStorage>::SInt,
3539
}

src/test/ui/const-generics/issues/issue-68977.stderr

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

0 commit comments

Comments
 (0)