Closed
Description
#![feature(negative_impls)]
struct Foo<T>(T);
impl !Send for Foo<()> {}
fn test<T>() -> T where Foo<T>: Send { todo!() }
fn main() {
let _: u8 = test();
}
Fails with
error[E0277]: `Foo<_>` cannot be sent between threads safely
--> $DIR/fk.rs:10:17
|
LL | fn test<T>() -> T where Foo<T>: Send { todo!() }
| ---- required by this bound in `test`
...
LL | let _: u8 = test();
| ^^^^ `Foo<_>` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `Foo<_>`
Explicitly specifying test::<u8>()
works though.