about summary refs log tree commit diff
path: root/tests/ui/traits/const-traits/item-bound-entailment-fails.rs
blob: f4bfcbda0ac4404712f963099d02ced3bfb2f803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//@ compile-flags: -Znext-solver
#![feature(const_trait_impl)]

#[const_trait] trait Foo {
    type Assoc<T>: ~const Bar
    where
        T: ~const Bar;
}

#[const_trait] trait Bar {}
struct N<T>(T);
impl<T> Bar for N<T> where T: Bar {}
struct C<T>(T);
impl<T> const Bar for C<T> where T: ~const Bar {}

impl const Foo for u32 {
    type Assoc<T> = N<T>
    //~^ ERROR the trait bound `N<T>: ~const Bar` is not satisfied
    where
        T: ~const Bar;
}

impl const Foo for i32 {
    type Assoc<T> = C<T>
    //~^ ERROR the trait bound `T: ~const Bar` is not satisfied
    where
        T: Bar;
}

fn main() {}