Skip to content

Commit

Permalink
Update issue-65436-raw-ptr-not-send.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
eholk committed Sep 13, 2022
1 parent 911c178 commit b950ae4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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 {
| _________________^
Expand All @@ -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`
Expand Down
Original file line number Diff line number Diff line change
@@ -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);

Expand All @@ -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;
})
}

0 comments on commit b950ae4

Please sign in to comment.