Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ui test to capture current situation of rust issue 93828 #193

Merged
merged 1 commit into from Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/ui/consider-restricting.rs
@@ -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() {}
33 changes: 33 additions & 0 deletions tests/ui/consider-restricting.stderr
@@ -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) {}
| +++++++++++++++++++