-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
impl Trait cannot work well with lifetime bounds #66551
Copy link
Copy link
Open
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Playground
The
self: &'s mut S<'t>implies't: 's, so the signature should be correct. But compiler still complain that'tis captured but does not appear inimplbounds.I checked the error description of
E0700and triedimpl FnMut() + 's where 't: 'sandimpl FnMut() + 's + 't, while it still fails.Note that when using
dyn Traitaspub fn foo<'s>(&'s mut self) -> Box<dyn FnMut() + 's>, it compiles.