1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
// run-pass #![allow(dead_code)] trait Trait { fn dummy(&self) { } } #[derive(Debug)] struct Foo<T: Trait> { foo: T, } #[derive(Debug)] struct Bar<T> where T: Trait { bar: T, } impl Trait for isize {} fn main() { let a = Foo { foo: 12 }; let b = Bar { bar: 12 }; println!("{:?} {:?}", a, b); }