Skip to content

Commit 90c5b8f

Browse files
authored
Rollup merge of #76599 - hameerabbasi:const-generics-revs, r=lcnr
Finish off revisions for const generics UI tests. This time it really does fix it. 😅 The only ones left are `min-and-full-same-time.rs`, which doesn't need it, and `array-impls/` which check the feature indirectly. Fixes #75279. r? @lcnr
2 parents 2477f07 + 5e188f5 commit 90c5b8f

9 files changed

+53
-11
lines changed

src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.stderr renamed to src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.full.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: constant expression depends on a generic parameter
2-
--> $DIR/feature-gate-const_evaluatable_checked.rs:6:30
2+
--> $DIR/feature-gate-const_evaluatable_checked.rs:9:30
33
|
44
LL | fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
55
| ^^^^^^
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/feature-gate-const_evaluatable_checked.rs:6:33
3+
|
4+
LL | type Arr<const N: usize> = [u8; 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+

src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +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 Arr<const N: usize> = [u8; N - 1];
7+
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
58

69
fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
7-
//~^ ERROR constant expression depends
10+
//[full]~^ ERROR constant expression depends
811
Default::default()
912
}
1013

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/simple.rs:8:33
3+
|
4+
LL | type Arr<const N: usize> = [u8; 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+

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
// run-pass
2-
#![feature(const_generics, const_evaluatable_checked)]
1+
// [full] run-pass
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))]
4+
#![cfg_attr(min, feature(min_const_generics))]
5+
#![feature(const_evaluatable_checked)]
36
#![allow(incomplete_features)]
47

58
type Arr<const N: usize> = [u8; N - 1];
9+
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
610

711
fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
812
Default::default()

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/simple_fail.rs:4:33
2+
--> $DIR/simple_fail.rs:7:33
33
|
44
LL | type Arr<const N: usize> = [u8; N - 1];
55
| ^^^^^ attempt to compute `0_usize - 1_usize` which would overflow
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/simple_fail.rs:7:33
3+
|
4+
LL | type Arr<const N: usize> = [u8; 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+

src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
#![feature(const_generics, const_evaluatable_checked)]
1+
// revisions: full min
2+
#![cfg_attr(full, feature(const_generics))]
3+
#![cfg_attr(min, feature(min_const_generics))]
4+
#![feature(const_evaluatable_checked)]
25
#![allow(incomplete_features)]
36

4-
type Arr<const N: usize> = [u8; N - 1]; //~ ERROR evaluation of constant
7+
type Arr<const N: usize> = [u8; N - 1]; //[full]~ ERROR evaluation of constant
8+
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
59

610
fn test<const N: usize>() -> Arr<N> where Arr<N>: Sized {
711
todo!()

src/test/ui/const-generics/type-dependent/auxiliary/type_dependent_lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#![feature(const_generics)]
2-
#![allow(incomplete_features)]
1+
#![cfg_attr(full, feature(const_generics))]
2+
#![cfg_attr(full, allow(incomplete_features))]
3+
#![cfg_attr(min, feature(min_const_generics))]
34

45
pub struct Struct<const N: usize>(());
56

0 commit comments

Comments
 (0)