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-generics/array-size-in-generic-struct-param.rs | |
| parent | c0e853f274c42665373b719a5bd7b3f95afe10c2 (diff) | |
| download | rust-0c28e028b6f45f33447f24de7dd762b8599b7a4e.tar.gz rust-0c28e028b6f45f33447f24de7dd762b8599b7a4e.zip | |
`feature(const_generics)` -> `feature(const_param_types)`
Diffstat (limited to 'src/test/ui/const-generics/array-size-in-generic-struct-param.rs')
| -rw-r--r-- | src/test/ui/const-generics/array-size-in-generic-struct-param.rs | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs deleted file mode 100644 index cd0a9742cd1..00000000000 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Tests that array sizes that depend on const-params are checked using `ConstEvaluatable`. -// revisions: full min - -#![cfg_attr(full, feature(const_generics))] -#![cfg_attr(full, allow(incomplete_features))] - -#[allow(dead_code)] -struct ArithArrayLen<const N: usize>([u32; 0 + N]); -//[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters may not be used in const operations - -#[derive(PartialEq, Eq)] -struct Config { - arr_size: usize, -} - -struct B<const CFG: Config> { - //[min]~^ ERROR `Config` is forbidden - arr: [u8; CFG.arr_size], - //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters may not be used in const operations -} - -const C: Config = Config { arr_size: 5 }; - -fn main() { - let b = B::<C> { arr: [1, 2, 3, 4, 5] }; - assert_eq!(b.arr.len(), 5); -} |
