-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #68269 - csmoe:temp, r=estebank
- Loading branch information
Showing
4 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// edition:2018 | ||
|
||
struct Foo(*const u8); | ||
|
||
unsafe impl Send for Foo {} | ||
|
||
async fn bar(_: Foo) {} | ||
|
||
fn assert_send<T: Send>(_: T) {} | ||
|
||
fn main() { | ||
assert_send(async { | ||
//~^ ERROR future cannot be sent between threads safely | ||
bar(Foo(std::ptr::null())).await; | ||
}) | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error: future cannot be sent between threads safely | ||
--> $DIR/issue-65436-raw-ptr-not-send.rs:12:5 | ||
| | ||
LL | fn assert_send<T: Send>(_: T) {} | ||
| ----------- ---- required by this bound in `assert_send` | ||
... | ||
LL | assert_send(async { | ||
| ^^^^^^^^^^^ future returned by `main` is not `Send` | ||
| | ||
= help: within `impl std::future::Future`, the trait `std::marker::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:9 | ||
| | ||
LL | bar(Foo(std::ptr::null())).await; | ||
| ^^^^^^^^----------------^^^^^^^^- `std::ptr::null()` is later dropped here | ||
| | | | ||
| | has type `*const u8` | ||
| await occurs here, with `std::ptr::null()` maybe used later | ||
help: consider moving this into a `let` binding to create a shorter lived borrow | ||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:13 | ||
| | ||
LL | bar(Foo(std::ptr::null())).await; | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|