-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ui test to capture current situation of rust issue 93828
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// https://github.com/rust-lang/rust/issues/93828 | ||
|
||
use async_trait::async_trait; | ||
|
||
pub trait IntoUrl {} | ||
|
||
#[async_trait] | ||
pub trait ClientExt { | ||
async fn publish<T: IntoUrl>(&self, url: T); | ||
} | ||
|
||
struct Client; | ||
|
||
#[async_trait] | ||
impl ClientExt for Client { | ||
async fn publish<T: IntoUrl>(&self, url: T) {} | ||
} | ||
|
||
struct Client2; | ||
|
||
#[async_trait] | ||
impl ClientExt for Client2 { | ||
async fn publish<T>(&self, url: T) {} | ||
} | ||
|
||
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,33 @@ | ||
error: future cannot be sent between threads safely | ||
--> tests/ui/consider-restricting.rs:16:49 | ||
| | ||
16 | async fn publish<T: IntoUrl>(&self, url: T) {} | ||
| ^^ future created by async block is not `Send` | ||
| | ||
note: captured value is not `Send` | ||
--> tests/ui/consider-restricting.rs:16:41 | ||
| | ||
16 | async fn publish<T: IntoUrl>(&self, url: T) {} | ||
| ^^^ has type `T` which is not `Send` | ||
= note: required for the cast to the object type `dyn Future<Output = ()> + Send` | ||
help: consider further restricting this bound | ||
| | ||
16 | async fn publish<T + std::marker::Send: IntoUrl>(&self, url: T) {} | ||
| +++++++++++++++++++ | ||
|
||
error: future cannot be sent between threads safely | ||
--> tests/ui/consider-restricting.rs:23:40 | ||
| | ||
23 | async fn publish<T>(&self, url: T) {} | ||
| ^^ future created by async block is not `Send` | ||
| | ||
note: captured value is not `Send` | ||
--> tests/ui/consider-restricting.rs:23:32 | ||
| | ||
23 | async fn publish<T>(&self, url: T) {} | ||
| ^^^ has type `T` which is not `Send` | ||
= note: required for the cast to the object type `dyn Future<Output = ()> + Send` | ||
help: consider further restricting this bound | ||
| | ||
23 | async fn publish<T + std::marker::Send>(&self, url: T) {} | ||
| +++++++++++++++++++ |