Wrong lifetime is inferred in the argument of closure when given more specific type. #51616
Labels
A-closures
Area: closures (`|args| { .. }`)
A-impl-trait
Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch.
A-lifetimes
Area: lifetime related
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I have lifetime bounds to a closure through a trait like this.
When I call
restrict_trait(|r| ...)
, I'll getr: &'static ()
inside the closure. But when usingrestrict_trait(|r: &_| ...)
, the lifetime ofr
inferred is not'static
anymore.Here is the detailed example
The text was updated successfully, but these errors were encountered: