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