Open
Description
This should compile, but it fails with a cryptic error message:
#![feature(type_alias_impl_trait)]
trait Trait {}
type Fut = impl Sized;
fn call<'a>() -> Fut
where
&'a (): Trait,
{
async {}
//~^ ERROR the trait bound `&'<empty> (): Trait` is not satisfied
}
The reason for this is that the hidden type of Fut
in the defining function is call::<'a>::generator#0
, but because we can't reference 'a
in the hidden type, the type is converted to call::<'empty>::generator#0
here:
The hidden type then fails WF checks because of the additional checks done in #96899 and #97183.
This now affects only type-alias-impl-trait, only because we don't WF-check the hidden type of return-position-impl-trait after borrow-checking.
@rustbot label A-impl-trait A-closures F-type_alias_impl_trait C-bug T-compiler T-types
Metadata
Metadata
Assignees
Labels
Area: Closures (`|…| { … }`)Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.`#[feature(type_alias_impl_trait)]`Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Projects
Status
Can do after stabilization