-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for issue 86507 add stderr for issue 86507 update issue-86507 UI test add comment for the expected error in UI test file add proper 'refers to <ref_type>' in suggestion update diagnostic phrasing; update test to match new phrasing; re-organize logic for checking T: Sync evaluate additional obligation to figure out if T is Sync run './x.py test tidy --bless' incorporate changes from review; reorganize logic for readability
- Loading branch information
1 parent
5c0ca08
commit 831ac19
Showing
3 changed files
with
78 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// edition:2018 | ||
|
||
use ::core::pin::Pin; | ||
use ::core::future::Future; | ||
use ::core::marker::Send; | ||
|
||
trait Foo { | ||
fn bar<'me, 'async_trait, T: Send>(x: &'me T) | ||
-> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> | ||
where 'me: 'async_trait; | ||
} | ||
|
||
impl Foo for () { | ||
fn bar<'me, 'async_trait, T: Send>(x: &'me T) | ||
-> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> | ||
where 'me:'async_trait { | ||
Box::pin( //~ ERROR future cannot be sent between threads safely | ||
async move { | ||
let x = x; | ||
} | ||
) | ||
} | ||
} | ||
|
||
fn main() { } |
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,23 @@ | ||
error: future cannot be sent between threads safely | ||
--> $DIR/issue-86507.rs:17:13 | ||
| | ||
LL | / Box::pin( | ||
LL | | async move { | ||
LL | | let x = x; | ||
LL | | } | ||
LL | | ) | ||
| |_____________^ future created by async block is not `Send` | ||
| | ||
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` | ||
--> $DIR/issue-86507.rs:19:29 | ||
| | ||
LL | let x = x; | ||
| ^ has type `&T` which is not `Send`, because `T` is not `Sync` | ||
= note: required for the cast to the object type `dyn Future<Output = ()> + Send` | ||
help: consider further restricting type parameter `T` | ||
| | ||
LL | where 'me:'async_trait, T: std::marker::Sync { | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|