diff options
Diffstat (limited to 'tests/ui/traits/enum-negative-send-impl.rs')
| -rw-r--r-- | tests/ui/traits/enum-negative-send-impl.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/ui/traits/enum-negative-send-impl.rs b/tests/ui/traits/enum-negative-send-impl.rs index bd560649b99..6bff42e9999 100644 --- a/tests/ui/traits/enum-negative-send-impl.rs +++ b/tests/ui/traits/enum-negative-send-impl.rs @@ -1,3 +1,7 @@ +//! Test that enums inherit Send/!Send properties from their variants. +//! +//! Uses the unstable `negative_impls` feature to explicitly opt-out of Send. + #![feature(negative_impls)] use std::marker::Send; @@ -5,14 +9,14 @@ use std::marker::Send; struct NoSend; impl !Send for NoSend {} -enum Foo { - A(NoSend) +enum Container { + WithNoSend(NoSend), } -fn bar<T: Send>(_: T) {} +fn requires_send<T: Send>(_: T) {} fn main() { - let x = Foo::A(NoSend); - bar(x); + let container = Container::WithNoSend(NoSend); + requires_send(container); //~^ ERROR `NoSend` cannot be sent between threads safely } |
