closures/async blocks capture all lifetimes in scope #100372
Labels
A-closures
Area: Closures (`|…| { … }`)
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-bug
Category: This is a bug.
F-type_alias_impl_trait
`#[feature(type_alias_impl_trait)]`
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
This should compile, but it fails with a cryptic error message:
The reason for this is that the hidden type of
Fut
in the defining function iscall::<'a>::generator#0
, but because we can't reference'a
in the hidden type, the type is converted tocall::<'empty>::generator#0
here:rust/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
Line 110 in 1603a70
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
The text was updated successfully, but these errors were encountered: