summaryrefslogtreecommitdiffstats
path: root/tests/ui/chalkify/type_wf.rs
blob: 37d2f5ca832ce6c9f0f7cbe69ecd0f16842e2f4f (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
// check-fail
// compile-flags: -Z trait-solver=chalk

trait Foo { }

struct S<T: Foo> {
    x: T,
}

impl Foo for i32 { }
impl<T> Foo for Option<T> { }

fn main() {
    let s = S {
       x: 5,
    };

    let s = S {
        x: 5.0, //~ ERROR the trait bound `{float}: Foo` is not satisfied
    };

    let s = S {
        x: Some(5.0),
    };
}