-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
306 additions
and
28 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
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
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,11 @@ | ||
use async_recursion::async_recursion; | ||
|
||
#[async_recursion(Sync)] | ||
async fn send_and_sync() {} | ||
|
||
fn assert_is_send_and_sync(_: impl Send + Sync) {} | ||
|
||
#[test] | ||
fn test_sync_argument() { | ||
assert_is_send_and_sync(send_and_sync()); | ||
} |
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,5 @@ | ||
use async_recursion::async_recursion; | ||
#[must_use] | ||
fn no_send_bound() -> ::core::pin::Pin<Box<dyn ::core::future::Future<Output = ()>>> { | ||
Box::pin(async move {}) | ||
} |
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,4 @@ | ||
use async_recursion::async_recursion; | ||
|
||
#[async_recursion(?Send)] | ||
async fn no_send_bound() {} |
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 @@ | ||
use async_recursion::async_recursion; | ||
#[must_use] | ||
fn not_send_sync_1() -> ::core::pin::Pin< | ||
Box<dyn ::core::future::Future<Output = ()> + ::core::marker::Sync>, | ||
> { | ||
Box::pin(async move {}) | ||
} | ||
#[must_use] | ||
fn not_send_sync_2() -> ::core::pin::Pin< | ||
Box<dyn ::core::future::Future<Output = ()> + ::core::marker::Sync>, | ||
> { | ||
Box::pin(async move {}) | ||
} | ||
#[must_use] | ||
fn sync_not_send_1() -> ::core::pin::Pin< | ||
Box<dyn ::core::future::Future<Output = ()> + ::core::marker::Sync>, | ||
> { | ||
Box::pin(async move {}) | ||
} | ||
#[must_use] | ||
fn sync_not_send_2() -> ::core::pin::Pin< | ||
Box<dyn ::core::future::Future<Output = ()> + ::core::marker::Sync>, | ||
> { | ||
Box::pin(async move {}) | ||
} |
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,13 @@ | ||
use async_recursion::async_recursion; | ||
|
||
#[async_recursion(?Send, Sync)] | ||
async fn not_send_sync_1() {} | ||
|
||
#[async_recursion(?Send,Sync)] | ||
async fn not_send_sync_2() {} | ||
|
||
#[async_recursion(Sync, ?Send)] | ||
async fn sync_not_send_1() {} | ||
|
||
#[async_recursion(Sync,?Send)] | ||
async fn sync_not_send_2() {} |
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,11 @@ | ||
use async_recursion::async_recursion; | ||
#[must_use] | ||
fn sync() -> ::core::pin::Pin< | ||
Box< | ||
dyn ::core::future::Future< | ||
Output = (), | ||
> + ::core::marker::Send + ::core::marker::Sync, | ||
>, | ||
> { | ||
Box::pin(async move {}) | ||
} |
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,4 @@ | ||
use async_recursion::async_recursion; | ||
|
||
#[async_recursion(Sync)] | ||
async fn sync() {} |
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,15 @@ | ||
use async_recursion::async_recursion; | ||
|
||
fn assert_is_sync(_: impl Sync) {} | ||
|
||
|
||
#[async_recursion] | ||
async fn send_not_sync() {} | ||
|
||
#[async_recursion(?Send)] | ||
async fn not_send_not_sync() {} | ||
|
||
fn main() { | ||
assert_is_sync(send_not_sync()); | ||
assert_is_sync(not_send_not_sync()); | ||
} |
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,51 @@ | ||
error[E0277]: `dyn Future<Output = ()> + Send` cannot be shared between threads safely | ||
--> tests/ui/arg_not_sync.rs:13:20 | ||
| | ||
13 | assert_is_sync(send_not_sync()); | ||
| -------------- ^^^^^^^^^^^^^^^ `dyn Future<Output = ()> + Send` cannot be shared between threads safely | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `Sync` is not implemented for `dyn Future<Output = ()> + Send` | ||
= note: required for `Unique<dyn Future<Output = ()> + Send>` to implement `Sync` | ||
note: required because it appears within the type `Box<dyn Future<Output = ()> + Send>` | ||
--> $RUST/alloc/src/boxed.rs | ||
| | ||
| pub struct Box< | ||
| ^^^ | ||
note: required because it appears within the type `Pin<Box<dyn Future<Output = ()> + Send>>` | ||
--> $RUST/core/src/pin.rs | ||
| | ||
| pub struct Pin<P> { | ||
| ^^^ | ||
note: required by a bound in `assert_is_sync` | ||
--> tests/ui/arg_not_sync.rs:3:27 | ||
| | ||
3 | fn assert_is_sync(_: impl Sync) {} | ||
| ^^^^ required by this bound in `assert_is_sync` | ||
|
||
error[E0277]: `dyn Future<Output = ()>` cannot be shared between threads safely | ||
--> tests/ui/arg_not_sync.rs:14:20 | ||
| | ||
14 | assert_is_sync(not_send_not_sync()); | ||
| -------------- ^^^^^^^^^^^^^^^^^^^ `dyn Future<Output = ()>` cannot be shared between threads safely | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `Sync` is not implemented for `dyn Future<Output = ()>` | ||
= note: required for `Unique<dyn Future<Output = ()>>` to implement `Sync` | ||
note: required because it appears within the type `Box<dyn Future<Output = ()>>` | ||
--> $RUST/alloc/src/boxed.rs | ||
| | ||
| pub struct Box< | ||
| ^^^ | ||
note: required because it appears within the type `Pin<Box<dyn Future<Output = ()>>>` | ||
--> $RUST/core/src/pin.rs | ||
| | ||
| pub struct Pin<P> { | ||
| ^^^ | ||
note: required by a bound in `assert_is_sync` | ||
--> tests/ui/arg_not_sync.rs:3:27 | ||
| | ||
3 | fn assert_is_sync(_: impl Sync) {} | ||
| ^^^^ required by this bound in `assert_is_sync` |
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,14 @@ | ||
use async_recursion::async_recursion; | ||
|
||
#[async_recursion(?Sync)] | ||
async fn not_sync() {} | ||
|
||
#[async_recursion(Sync Sync)] | ||
async fn not_punctuated() {} | ||
|
||
#[async_recursion(Sync?Send)] | ||
async fn what_even_is_this() {} | ||
|
||
|
||
|
||
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,17 @@ | ||
error: failed to parse macro arguments: expected `Send` | ||
--> tests/ui/args_invalid.rs:3:20 | ||
| | ||
3 | #[async_recursion(?Sync)] | ||
| ^^^^ | ||
|
||
error: failed to parse macro arguments: expected `,` | ||
--> tests/ui/args_invalid.rs:6:24 | ||
| | ||
6 | #[async_recursion(Sync Sync)] | ||
| ^^^^ | ||
|
||
error: failed to parse macro arguments: expected `,` | ||
--> tests/ui/args_invalid.rs:9:23 | ||
| | ||
9 | #[async_recursion(Sync?Send)] | ||
| ^ |
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,12 @@ | ||
use async_recursion::async_recursion; | ||
|
||
#[async_recursion(?Send, ?Send)] | ||
async fn repeated_args_1() {} | ||
|
||
#[async_recursion(?Send, Sync, ?Send)] | ||
async fn repeated_args_2() {} | ||
|
||
#[async_recursion(Sync, ?Send, Sync, ?Send)] | ||
async fn repeated_args_3() {} | ||
|
||
fn main() {} |
Oops, something went wrong.