rust/tests/pass/sendable-class.rs

20 lines
318 B
Rust
Raw Normal View History

2016-11-15 15:19:38 +01:00
// Test that a class with only sendable fields can be sent
use std::sync::mpsc::channel;
#[allow(dead_code)]
struct Foo {
i: isize,
j: char,
}
fn foo(i: isize, j: char) -> Foo {
Foo { i: i, j: j }
2016-11-15 15:19:38 +01:00
}
pub fn main() {
let (tx, rx) = channel();
2018-11-26 15:31:53 +01:00
tx.send(foo(42, 'c')).unwrap();
let _val = rx;
2016-11-15 15:19:38 +01:00
}