]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/issues/issue-62504.rs
Add a comment why rustdoc loads crates from the sysroot
[rust.git] / src / test / ui / const-generics / issues / issue-62504.rs
1 // revisions: full min
2 #![allow(incomplete_features)]
3 #![cfg_attr(full, feature(const_generics))]
4 #![cfg_attr(full, allow(incomplete_features))]
5 #![cfg_attr(min, feature(min_const_generics))]
6
7 trait HasSize {
8     const SIZE: usize;
9 }
10
11 impl<const X: usize> HasSize for ArrayHolder<X> {
12     const SIZE: usize = X;
13 }
14
15 struct ArrayHolder<const X: usize>([u32; X]);
16
17 impl<const X: usize> ArrayHolder<X> {
18     pub const fn new() -> Self {
19         ArrayHolder([0; Self::SIZE])
20         //[full]~^ ERROR constant expression depends on a generic parameter
21         //[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
22     }
23 }
24
25 fn main() {
26     let mut array = ArrayHolder::new();
27 }