-
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.
- Loading branch information
1 parent
ef4046e
commit 0be510e
Showing
3 changed files
with
62 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,21 @@ | ||
// edition:2021 | ||
|
||
#![feature(async_fn_in_trait)] | ||
//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes | ||
|
||
trait Foo { | ||
async fn bar(); | ||
} | ||
|
||
async fn test<T: Foo>() { | ||
T::bar().await; | ||
} | ||
|
||
fn test2<T: Foo>() { | ||
assert_is_send(test::<T>()); | ||
//~^ ERROR future cannot be sent between threads safely | ||
} | ||
|
||
fn assert_is_send(_: impl Send) {} | ||
|
||
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,29 @@ | ||
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/missing-send-bound.rs:3:12 | ||
| | ||
LL | #![feature(async_fn_in_trait)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: future cannot be sent between threads safely | ||
--> $DIR/missing-send-bound.rs:15:20 | ||
| | ||
LL | assert_is_send(test::<T>()); | ||
| ^^^^^^^^^^^ future returned by `test` is not `Send` | ||
| | ||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>` | ||
note: future is not `Send` as it awaits another future which is not `Send` | ||
--> $DIR/missing-send-bound.rs:11:5 | ||
| | ||
LL | T::bar().await; | ||
| ^^^^^^^^ await occurs here on type `impl Future<Output = ()>`, which is not `Send` | ||
note: required by a bound in `assert_is_send` | ||
--> $DIR/missing-send-bound.rs:19:27 | ||
| | ||
LL | fn assert_is_send(_: impl Send) {} | ||
| ^^^^ required by this bound in `assert_is_send` | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|