]> git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/issues/issue-62504.rs
New upstream version 1.55.0+dfsg1
[rustc.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
6 trait HasSize {
7 const SIZE: usize;
8 }
9
10 impl<const X: usize> HasSize for ArrayHolder<X> {
11 const SIZE: usize = X;
12 }
13
14 struct ArrayHolder<const X: usize>([u32; X]);
15
16 impl<const X: usize> ArrayHolder<X> {
17 pub const fn new() -> Self {
18 ArrayHolder([0; Self::SIZE])
19 //~^ ERROR constant expression depends on a generic parameter
20 //~| ERROR mismatched types
21 }
22 }
23
24 fn main() {
25 let mut array = ArrayHolder::new();
26 }