]> git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/wf-misc.rs
New upstream version 1.49.0~beta.4+dfsg1
[rustc.git] / src / test / ui / const-generics / wf-misc.rs
1 // Tests miscellaneous well-formedness examples.
2 // revisions: full min
3
4 #![cfg_attr(full, feature(const_generics))]
5 #![cfg_attr(full, allow(incomplete_features))]
6 #![cfg_attr(min, feature(min_const_generics))]
7
8 pub fn arr_len<const N: usize>() {
9 let _: [u8; N + 1];
10 //[full]~^ ERROR constant expression depends on a generic parameter
11 //[min]~^^ ERROR generic parameters may not be used in const operations
12 }
13
14 struct Const<const N: usize>;
15
16 pub fn func_call<const N: usize>() {
17 let _: Const::<{N + 1}>;
18 //[full]~^ ERROR constant expression depends on a generic parameter
19 //[min]~^^ ERROR generic parameters may not be used in const operations
20 }
21
22 fn main() {}