rust/tests/ui/const-generics/defaults/wfness.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
617 B
Rust
Raw Normal View History

2021-10-20 17:31:08 -05:00
struct Ooopsies<const N: u8 = { u8::MAX + 1 }>;
//~^ error: evaluation of constant value failed
trait Trait<const N: u8> {}
impl Trait<3> for () {}
struct WhereClause<const N: u8 = 2>
where
(): Trait<N>;
//~^ error: the trait bound `(): Trait<2>` is not satisfied
2021-10-20 17:31:08 -05:00
trait Traitor<T, const N: u8> {}
struct WhereClauseTooGeneric<T = u32, const N: u8 = 2>(T)
where
(): Traitor<T, N>;
2021-10-20 17:31:08 -05:00
2021-10-20 18:16:49 -05:00
// no error on struct def
2021-10-20 17:31:08 -05:00
struct DependentDefaultWfness<const N: u8 = 1, T = WhereClause<N>>(T);
fn foo() -> DependentDefaultWfness {
//~^ error: the trait bound `(): Trait<1>` is not satisfied
2021-10-20 17:31:08 -05:00
loop {}
}
fn main() {}