about summary refs log tree commit diff
path: root/tests/ui/traits/enum-negative-send-impl.rs
blob: 6bff42e999919fac6d1844b3c195b6d8ead92768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! 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;

struct NoSend;
impl !Send for NoSend {}

enum Container {
    WithNoSend(NoSend),
}

fn requires_send<T: Send>(_: T) {}

fn main() {
    let container = Container::WithNoSend(NoSend);
    requires_send(container);
    //~^ ERROR `NoSend` cannot be sent between threads safely
}