rust/tests/ui/issues/issue-15155.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
643 B
Rust
Raw Normal View History

// run-pass
trait TraitWithSend: Send {}
trait IndirectTraitWithSend: TraitWithSend {}
// Check struct instantiation (Box<TraitWithSend> will only have Send if TraitWithSend has Send)
#[allow(dead_code)]
2019-05-28 13:47:21 -05:00
struct Blah { x: Box<dyn TraitWithSend> }
impl TraitWithSend for Blah {}
// Struct instantiation 2-levels deep
#[allow(dead_code)]
2019-05-28 13:47:21 -05:00
struct IndirectBlah { x: Box<dyn IndirectTraitWithSend> }
impl TraitWithSend for IndirectBlah {}
impl IndirectTraitWithSend for IndirectBlah {}
2014-12-24 01:05:30 -06:00
fn test_trait<T: Send + ?Sized>() { println!("got here!") }
fn main() {
2019-05-28 13:47:21 -05:00
test_trait::<dyn TraitWithSend>();
test_trait::<dyn IndirectTraitWithSend>();
}