]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/infer_arg_from_pat.rs
Rollup merge of #80382 - GuillaumeGomez:search-result-tab-picking, r=Nemo157,pickfire
[rust.git] / src / test / ui / const-generics / infer_arg_from_pat.rs
1 // run-pass
2 //
3 // see issue #70529
4 // revisions: full min
5
6 #![cfg_attr(full, feature(const_generics))]
7 #![cfg_attr(full, allow(incomplete_features))]
8
9 struct A<const N: usize> {
10     arr: [u8; N],
11 }
12
13 impl<const N: usize> A<N> {
14     fn new() -> Self {
15         A {
16             arr: [0; N],
17         }
18     }
19
20     fn value(&self) -> usize {
21         N
22     }
23 }
24
25 fn main() {
26     let a = A::new();
27     let [_, _] = a.arr;
28     assert_eq!(a.value(), 2);
29 }