diff options
Diffstat (limited to 'tests/ui/traits/negative-impls/negated-auto-traits-rpass.rs')
-rw-r--r-- | tests/ui/traits/negative-impls/negated-auto-traits-rpass.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-rpass.rs b/tests/ui/traits/negative-impls/negated-auto-traits-rpass.rs new file mode 100644 index 000000000..a1042f831 --- /dev/null +++ b/tests/ui/traits/negative-impls/negated-auto-traits-rpass.rs @@ -0,0 +1,21 @@ +// run-pass +#![allow(unused_variables)] +#![feature(negative_impls)] + +use std::marker::Send; + +pub struct WaitToken; +impl !Send for WaitToken {} + +pub struct Test<T>(#[allow(unused_tuple_struct_fields)] T); +unsafe impl<T: 'static> Send for Test<T> {} + +pub fn spawn<F>(_: F) -> () where F: FnOnce(), F: Send + 'static {} + +fn main() { + let wt = Test(WaitToken); + spawn(move || { + let x = wt; + println!("Hello, World!"); + }); +} |