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 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), }; }