-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed as not planned
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.F-return_position_impl_trait_in_trait`#![feature(return_position_impl_trait_in_trait)]``#![feature(return_position_impl_trait_in_trait)]`I-cycleIssue: A query cycle occurred while none was expectedIssue: A query cycle occurred while none was expectedT-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.WG-asyncWorking group: Async & awaitWorking group: Async & await
Description
Here is the reproducer:
use std::future::Future;
use futures::FutureExt;
struct Object(Box<Object>);
trait Trait {
fn iter(&self) -> impl Sized + Send + Future<Output = ()>;
}
impl Trait for Object {
// Compiles
#[cfg(any())]
fn iter(&self) -> impl Sized + Send + Future<Output = ()> {
async move {
self.0.iter().boxed().await;
}
}
// Does not compile
#[cfg(all())]
async fn iter(&self) {
self.0.iter().boxed().await;
}
}
Interestingly, if you swap the any/all, then the version with -> impl Sized + Send + Future<Output = ()>
does compile properly.
So something in async fn
is not just desugared as -> impl Sized + Send + Future
, but I'm not sure why that is?
Possibly related to:
aposto, kokoichi206, lewcc and frederikhorskokoichi206
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.F-return_position_impl_trait_in_trait`#![feature(return_position_impl_trait_in_trait)]``#![feature(return_position_impl_trait_in_trait)]`I-cycleIssue: A query cycle occurred while none was expectedIssue: A query cycle occurred while none was expectedT-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.WG-asyncWorking group: Async & awaitWorking group: Async & await