Open
Description
#![feature(never_type)]
use std::rc::Rc;
// struct that is neither send nor constructable
struct NotSend {
no_construct: !,
no_send: Rc<()>,
}
// struct that is both send and constructable
struct IsSend;
// is not send even though the non-send variant can never be constructed
enum AlsoNotSend {
CanBeConstructed(IsSend), // is send
CannotBeConstructed(NotSend), // is not send
}
fn takes_send<T: Send>() {}
fn main() {
takes_send::<IsSend>();
// ^^ compiles fine!
// takes_send::<AlsoNotSend>();
// ^^ does not compile!
// takes_send::<Result<u8, (!, Rc<()>)>>();
// ^^ also affects this case!
}
another example can be found here