]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/defaults/wfness.rs
Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obk
[rust.git] / src / test / ui / const-generics / defaults / wfness.rs
1 #![feature(const_generics_defaults)]
2
3 struct Ooopsies<const N: u8 = { u8::MAX + 1 }>;
4 //~^ error: evaluation of constant value failed
5
6 trait Trait<const N: u8> {}
7 impl Trait<3> for () {}
8 struct WhereClause<const N: u8 = 2> where (): Trait<N>;
9 //~^ error: the trait bound `(): Trait<2_u8>` is not satisfied
10
11 trait Traitor<T, const N: u8> {}
12 struct WhereClauseTooGeneric<T = u32, const N: u8 = 2>(T) where (): Traitor<T, N>;
13
14 // no error on struct def
15 struct DependentDefaultWfness<const N: u8 = 1, T = WhereClause<N>>(T);
16 fn foo() -> DependentDefaultWfness {
17     //~^ error: the trait bound `(): Trait<1_u8>` is not satisfied
18     loop {}
19 }
20
21 fn main() {}