]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-15155.rs
Rollup merge of #91804 - woppopo:const_clone, r=oli-obk
[rust.git] / src / test / ui / issues / issue-15155.rs
1 // run-pass
2 trait TraitWithSend: Send {}
3 trait IndirectTraitWithSend: TraitWithSend {}
4
5 // Check struct instantiation (Box<TraitWithSend> will only have Send if TraitWithSend has Send)
6 #[allow(dead_code)]
7 struct Blah { x: Box<dyn TraitWithSend> }
8 impl TraitWithSend for Blah {}
9
10 // Struct instantiation 2-levels deep
11 #[allow(dead_code)]
12 struct IndirectBlah { x: Box<dyn IndirectTraitWithSend> }
13 impl TraitWithSend for IndirectBlah {}
14 impl IndirectTraitWithSend for IndirectBlah {}
15
16 fn test_trait<T: Send + ?Sized>() { println!("got here!") }
17
18 fn main() {
19     test_trait::<dyn TraitWithSend>();
20     test_trait::<dyn IndirectTraitWithSend>();
21 }