Update partial-drop-partial-reinit.rs

This commit is contained in:
Eric Holk 2022-09-13 14:41:07 -07:00
parent b950ae44e0
commit 5671a76119
3 changed files with 45 additions and 7 deletions

View file

@ -0,0 +1,35 @@
error[E0277]: `NotSend` cannot be sent between threads safely
--> $DIR/partial-drop-partial-reinit.rs:9:16
|
LL | gimme_send(foo());
| ---------- ^^^^^ `NotSend` cannot be sent between threads safely
| |
| required by a bound introduced by this call
...
LL | async fn foo() {
| - within this `impl Future<Output = ()>`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`
= note: required because it appears within the type `(NotSend,)`
= note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `()`, `impl Future<Output = ()>`
note: required because it's used within this `async fn` body
--> $DIR/partial-drop-partial-reinit.rs:31:16
|
LL | async fn foo() {
| ________________^
LL | |
LL | |
LL | | let mut x = (NotSend {},);
... |
LL | | bar().await;
LL | | }
| |_^
note: required by a bound in `gimme_send`
--> $DIR/partial-drop-partial-reinit.rs:17:18
|
LL | fn gimme_send<T: Send>(t: T) {
| ^^^^ required by this bound in `gimme_send`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,5 +1,5 @@
error[E0277]: `NotSend` cannot be sent between threads safely
--> $DIR/partial-drop-partial-reinit.rs:6:16
--> $DIR/partial-drop-partial-reinit.rs:9:16
|
LL | gimme_send(foo());
| ---------- ^^^^^ `NotSend` cannot be sent between threads safely
@ -13,7 +13,7 @@ LL | async fn foo() {
= note: required because it appears within the type `(NotSend,)`
= note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future<Output = ()>`, `()`
note: required because it's used within this `async fn` body
--> $DIR/partial-drop-partial-reinit.rs:28:16
--> $DIR/partial-drop-partial-reinit.rs:31:16
|
LL | async fn foo() {
| ________________^
@ -25,7 +25,7 @@ LL | | bar().await;
LL | | }
| |_^
note: required by a bound in `gimme_send`
--> $DIR/partial-drop-partial-reinit.rs:14:18
--> $DIR/partial-drop-partial-reinit.rs:17:18
|
LL | fn gimme_send<T: Send>(t: T) {
| ^^^^ required by this bound in `gimme_send`

View file

@ -1,4 +1,7 @@
// edition:2021
// revisions: no_drop_tracking drop_tracking
// [drop_tracking] compile-flags: -Zdrop-tracking=yes
// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
#![feature(negative_impls)]
#![allow(unused)]
@ -12,8 +15,8 @@ fn main() {
}
fn gimme_send<T: Send>(t: T) {
//~^ NOTE required by this bound
//~| NOTE required by a bound
//~^ NOTE required by this bound
//~| NOTE required by a bound
drop(t);
}
@ -26,8 +29,8 @@ impl Drop for NotSend {
impl !Send for NotSend {}
async fn foo() {
//~^ NOTE used within this `async fn` body
//~| NOTE within this `impl Future
//~^ NOTE used within this `async fn` body
//~| NOTE within this `impl Future
let mut x = (NotSend {},);
drop(x.0);
x.0 = NotSend {};