]> git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/issues/issue-61935.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / const-generics / issues / issue-61935.rs
1 // revisions: full min
2 #![cfg_attr(full, feature(const_generics))]
3 #![cfg_attr(full, allow(incomplete_features))]
4 #![cfg_attr(min, feature(min_const_generics))]
5
6 trait Foo {}
7
8 impl<const N: usize> Foo for [(); N]
9 where
10 Self:FooImpl<{N==0}>
11 //[full]~^ERROR constant expression depends on a generic parameter
12 //[min]~^^ERROR generic parameters must not be used inside of non trivial constant values
13 {}
14
15 trait FooImpl<const IS_ZERO: bool>{}
16
17 impl FooImpl<true> for [(); 0] {}
18
19 impl<const N:usize> FooImpl<false> for [();N] {}
20
21 fn foo(_: impl Foo) {}
22
23 fn main() {
24 foo([]);
25 foo([()]);
26 }