2014-07-22 11:46:36 +00:00
|
|
|
// Test which of the builtin types are considered sendable.
|
|
|
|
|
|
|
|
fn assert_send<T:Send>() { }
|
|
|
|
|
|
|
|
// owned content are ok
|
2015-01-08 10:54:35 +00:00
|
|
|
fn test30() { assert_send::<Box<isize>>(); }
|
2014-07-22 11:46:36 +00:00
|
|
|
fn test31() { assert_send::<String>(); }
|
2015-01-08 10:54:35 +00:00
|
|
|
fn test32() { assert_send::<Vec<isize> >(); }
|
2014-07-22 11:46:36 +00:00
|
|
|
|
|
|
|
// but not if they own a bad thing
|
2015-02-17 12:48:32 +00:00
|
|
|
fn test40() {
|
2018-06-09 23:53:36 +00:00
|
|
|
assert_send::<Box<*mut u8>>();
|
|
|
|
//~^ ERROR `*mut u8` cannot be sent between threads safely
|
2014-07-22 11:46:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|