Update issue-65436-raw-ptr-not-send.rs

This commit is contained in:
Eric Holk 2022-09-13 14:39:36 -07:00
parent 911c178f03
commit b950ae44e0
2 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
--> $DIR/issue-65436-raw-ptr-not-send.rs:12:17
--> $DIR/issue-65436-raw-ptr-not-send.rs:16:17
|
LL | assert_send(async {
| _________________^
@ -10,24 +10,24 @@ LL | | })
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:35
--> $DIR/issue-65436-raw-ptr-not-send.rs:18:35
|
LL | bar(Foo(std::ptr::null())).await;
| ---------------- ^^^^^^ await occurs here, with `std::ptr::null()` maybe used later
| |
| has type `*const u8` which is not `Send`
note: `std::ptr::null()` is later dropped here
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:41
--> $DIR/issue-65436-raw-ptr-not-send.rs:18:41
|
LL | bar(Foo(std::ptr::null())).await;
| ^
help: consider moving this into a `let` binding to create a shorter lived borrow
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:13
--> $DIR/issue-65436-raw-ptr-not-send.rs:18:13
|
LL | bar(Foo(std::ptr::null())).await;
| ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `assert_send`
--> $DIR/issue-65436-raw-ptr-not-send.rs:9:19
--> $DIR/issue-65436-raw-ptr-not-send.rs:13:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`

View File

@ -1,4 +1,8 @@
// edition:2018
// revisions: no_drop_tracking drop_tracking
// [drop_tracking] check-pass
// [drop_tracking] compile-flags: -Zdrop-tracking=yes
// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
struct Foo(*const u8);
@ -10,7 +14,7 @@ fn assert_send<T: Send>(_: T) {}
fn main() {
assert_send(async {
//~^ ERROR future cannot be sent between threads safely
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
bar(Foo(std::ptr::null())).await;
})
}