]> git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs
New upstream version 1.49.0~beta.4+dfsg1
[rustc.git] / src / test / ui / const-generics / const_evaluatable_checked / feature-gate-const_evaluatable_checked.rs
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))]
5
6 type Arr<const N: usize> = [u8; N - 1];
7 //[min]~^ ERROR generic parameters may not be used in const operations
8
9 fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
10 //[full]~^ ERROR constant expression depends
11 Default::default()
12 }
13
14 fn main() {
15 let x = test::<33>();
16 assert_eq!(x, [0; 32]);
17 }