2022-01-05 14:11:37 -08:00
|
|
|
//@ edition:2021
|
|
|
|
#![feature(negative_impls)]
|
|
|
|
#![allow(unused)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
gimme_send(foo());
|
|
|
|
//~^ ERROR cannot be sent between threads safely
|
2022-06-19 13:59:36 -05:00
|
|
|
//~| NOTE cannot be sent
|
|
|
|
//~| NOTE bound introduced by
|
|
|
|
//~| NOTE appears within the type
|
2022-01-05 14:11:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn gimme_send<T: Send>(t: T) {
|
2022-09-13 14:41:07 -07:00
|
|
|
//~^ NOTE required by this bound
|
|
|
|
//~| NOTE required by a bound
|
2022-01-05 14:11:37 -08:00
|
|
|
drop(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NotSend {}
|
|
|
|
|
|
|
|
impl Drop for NotSend {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl !Send for NotSend {}
|
|
|
|
|
|
|
|
async fn foo() {
|
2023-10-25 16:26:36 +00:00
|
|
|
//~^ NOTE used within this `async` fn body
|
2022-09-13 14:41:07 -07:00
|
|
|
//~| NOTE within this `impl Future
|
2022-01-05 14:11:37 -08:00
|
|
|
let mut x = (NotSend {},);
|
|
|
|
drop(x.0);
|
|
|
|
x.0 = NotSend {};
|
|
|
|
bar().await;
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn bar() {}
|