diff options
| author | lcnr <rust@lcnr.de> | 2021-08-27 18:04:57 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2021-08-30 11:00:21 +0200 |
| commit | 0c28e028b6f45f33447f24de7dd762b8599b7a4e (patch) | |
| tree | 3a573ebc79c4aefed676f4a693ebb62d32ea4e7f /src/test/ui/const_evaluatable | |
| parent | c0e853f274c42665373b719a5bd7b3f95afe10c2 (diff) | |
`feature(const_generics)` -> `feature(const_param_types)`
Diffstat (limited to 'src/test/ui/const_evaluatable')
| -rw-r--r-- | src/test/ui/const_evaluatable/associated-const.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/const_evaluatable/function-call.rs | 19 | ||||
| -rw-r--r-- | src/test/ui/const_evaluatable/function-call.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/const_evaluatable/needs_where_clause.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/const_evaluatable/needs_where_clause.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/const_evaluatable/no_where_clause.rs | 29 | ||||
| -rw-r--r-- | src/test/ui/const_evaluatable/no_where_clause.stderr | 10 |
7 files changed, 0 insertions, 105 deletions
diff --git a/src/test/ui/const_evaluatable/associated-const.rs b/src/test/ui/const_evaluatable/associated-const.rs deleted file mode 100644 index a6777632254..00000000000 --- a/src/test/ui/const_evaluatable/associated-const.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -struct Foo<T>(T); -impl<T> Foo<T> { - const VALUE: usize = std::mem::size_of::<T>(); -} - -fn test<T>() { - let _ = [0; Foo::<u8>::VALUE]; -} - -fn main() {} diff --git a/src/test/ui/const_evaluatable/function-call.rs b/src/test/ui/const_evaluatable/function-call.rs deleted file mode 100644 index b5de66621c5..00000000000 --- a/src/test/ui/const_evaluatable/function-call.rs +++ /dev/null @@ -1,19 +0,0 @@ -// check-pass - -const fn foo<T>() -> usize { - // We might instead branch on `std::mem::size_of::<*mut T>() < 8` here, - // which would cause this function to fail on 32 bit systems. - if false { - std::mem::size_of::<T>() - } else { - 8 - } -} - -fn test<T>() { - let _ = [0; foo::<T>()]; - //~^ WARN cannot use constants which depend on generic parameters in types - //~| WARN this was previously accepted by the compiler but is being phased out -} - -fn main() {} diff --git a/src/test/ui/const_evaluatable/function-call.stderr b/src/test/ui/const_evaluatable/function-call.stderr deleted file mode 100644 index 0d8463714e8..00000000000 --- a/src/test/ui/const_evaluatable/function-call.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: cannot use constants which depend on generic parameters in types - --> $DIR/function-call.rs:14:17 - | -LL | let _ = [0; foo::<T>()]; - | ^^^^^^^^^^ - | - = note: `#[warn(const_evaluatable_unchecked)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200> - -warning: 1 warning emitted - diff --git a/src/test/ui/const_evaluatable/needs_where_clause.rs b/src/test/ui/const_evaluatable/needs_where_clause.rs deleted file mode 100644 index e8a625101d6..00000000000 --- a/src/test/ui/const_evaluatable/needs_where_clause.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "lib"] -#![feature(const_generics, generic_const_exprs)] -#![allow(incomplete_features)] - -const fn complex_maths<T>(n : usize) -> usize { - 2 * n + 1 -} - -struct Example<T, const N: usize> { - a: [f32; N], - b: [f32; complex_maths::<T>(N)], - //~^ ERROR unconstrained - c: T, -} diff --git a/src/test/ui/const_evaluatable/needs_where_clause.stderr b/src/test/ui/const_evaluatable/needs_where_clause.stderr deleted file mode 100644 index 7b41e39b7d7..00000000000 --- a/src/test/ui/const_evaluatable/needs_where_clause.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unconstrained generic constant - --> $DIR/needs_where_clause.rs:11:6 - | -LL | b: [f32; complex_maths::<T>(N)], - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); complex_maths::<T>(N)]:` - -error: aborting due to previous error - diff --git a/src/test/ui/const_evaluatable/no_where_clause.rs b/src/test/ui/const_evaluatable/no_where_clause.rs deleted file mode 100644 index 6ae517af0d5..00000000000 --- a/src/test/ui/const_evaluatable/no_where_clause.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![feature(const_generics, generic_const_exprs)] -#![allow(incomplete_features, unused)] - -const fn complex_maths(n : usize) -> usize { - 2 * n + 1 -} - -pub struct Example<const N: usize> { - a: [f32; N], - b: [f32; complex_maths(N)], - //~^ ERROR unconstrained generic -} - -impl<const N: usize> Example<N> { - pub fn new() -> Self { - Self { - a: [0.; N], - b: [0.; complex_maths(N)], - } - } -} - -impl Example<2> { - pub fn sum(&self) -> f32 { - self.a.iter().sum::<f32>() + self.b.iter().sum::<f32>() - } -} - -fn main() {} diff --git a/src/test/ui/const_evaluatable/no_where_clause.stderr b/src/test/ui/const_evaluatable/no_where_clause.stderr deleted file mode 100644 index 3e5c2f5cad1..00000000000 --- a/src/test/ui/const_evaluatable/no_where_clause.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unconstrained generic constant - --> $DIR/no_where_clause.rs:10:6 - | -LL | b: [f32; complex_maths(N)], - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); complex_maths(N)]:` - -error: aborting due to previous error - |
