1 // For `Send` generators, suggest a `T: Sync` requirement for `&T` upvars,
2 // and suggest a `T: Send` requirement for `&mut T` upvars.
4 #![feature(generators)]
6 fn assert_send<T: Send>(_: T) {}
7 //~^ NOTE required by a bound in `assert_send`
8 //~| NOTE required by this bound in `assert_send`
9 //~| NOTE required by a bound in `assert_send`
10 //~| NOTE required by this bound in `assert_send`
13 let x: &*mut () = &std::ptr::null_mut();
14 let y: &mut *mut () = &mut std::ptr::null_mut();
16 //~^ ERROR generator cannot be sent between threads safely
17 //~| NOTE generator is not `Send`
21 //~^^ NOTE captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
22 //~| NOTE has type `&*mut ()` which is not `Send`, because `*mut ()` is not `Sync`
24 //~^ ERROR generator cannot be sent between threads safely
25 //~| NOTE generator is not `Send`
29 //~^^ NOTE captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send`
30 //~| NOTE has type `&mut *mut ()` which is not `Send`, because `*mut ()` is not `Send`