-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Associated type with a 'static bound still captures lifetimes when using impl Trait. #106684
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-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
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-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-typesRelevant to the types 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
Fields
Give feedbackNo fields configured for issues without a type.
Using a returned
impl Traitfor a trait with an associated type and not specifying the associated type leads to the following error:..even when
+ 'staticis specified, meaning no lifetimes should be captured. Adding#![feature(associated_type_bounds)]and instead usingimpl Trait<AssocType: 'static>as a return type solves the issue. I'm not sure if this is intended behavior - it seems pretty strange sinceAssocTypeis defined with a'staticbound. See the code below for a reproducible example.Meta
rustc --version --verbose: