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

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

22 lines
644 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 18:47:21 +00:00
struct Blah { x: Box<dyn TraitWithSend> }
impl TraitWithSend for Blah {}
// Struct instantiation 2-levels deep
#[allow(dead_code)]
2019-05-28 18:47:21 +00:00
struct IndirectBlah { x: Box<dyn IndirectTraitWithSend> }
impl TraitWithSend for IndirectBlah {}
impl IndirectTraitWithSend for IndirectBlah {}
2014-12-24 07:05:30 +00:00
fn test_trait<T: Send + ?Sized>() { println!("got here!") }
fn main() {
2019-05-28 18:47:21 +00:00
test_trait::<dyn TraitWithSend>();
test_trait::<dyn IndirectTraitWithSend>();
}