1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT 2 // file at the top-level directory of this distribution and at 3 // http://rust-lang.org/COPYRIGHT. 4 // 5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or 6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your 8 // option. This file may not be copied, modified, or distributed 9 // except according to those terms. 10 11 #[cfg(feature = "use_core")] 12 extern crate core; 13 dummy(&self)14trait Trait { fn dummy(&self) { } } 15 16 #[macro_use] 17 extern crate derivative; 18 19 #[derive(Derivative)] 20 #[derivative(Debug)] 21 struct Foo<T: Trait> { 22 foo: T, 23 } 24 25 #[derive(Derivative)] 26 #[derivative(Debug)] 27 struct Bar<T> where T: Trait { 28 bar: T, 29 } 30 31 impl Trait for isize {} 32 33 #[test] main()34fn main() { 35 let a = Foo { foo: 12 }; 36 let b = Bar { bar: 12 }; 37 println!("{:?} {:?}", a, b); 38 } 39