about summary refs log tree commit diff
path: root/src/test/ui/const-generics/const-generic-array-wrapper.rs
blob: 224fc794e327f5d4006a6373471a041606d70d5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// run-pass
// revisions: full min

#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]

struct Foo<T, const N: usize>([T; N]);

impl<T, const N: usize> Foo<T, N> {
    fn foo(&self) -> usize {
        N
    }
}

fn main() {
    let foo = Foo([0u32; 21]);
    assert_eq!(foo.0, [0u32; 21]);
    assert_eq!(foo.foo(), 21);
}