-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Update: See #60658 (comment) for the latest reproducer
Minimal:
#![feature(async_await, await_macro)]
use std::future::Future;
pub trait Foo<'a> {
type Future: Future<Output = ()>;
fn foo() -> Self::Future;
}
struct MyType<T>;
impl<'a, T> Foo<'a> for MyType<T>
where
T: Foo<'a>,
T::Future: Send,
{
type Future = Box<Future<Output = ()> + Send>;
fn foo() -> Self::Future {
Box::new(async move {
await!(T::foo())
})
}
}
fn main() {
}
Out:
Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
--> src/main.rs:21:9
|
21 | / Box::new(async move {
22 | | await!(T::foo())
23 | | })
| |__________^ one type is more general than the other
|
= note: expected type `std::marker::Send`
found type `std::marker::Send`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
Compiler version: rustc 1.36.0-nightly (2019-05-07)
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
On deck