-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
nested RPIT and HRTB: unclear semantics and future incompatibility #96194
Copy link
Copy link
Closed
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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
(Original post in internals forum)
Given the following code (stable sin 1.30!):
It is undocumented whether the inner existential type,
impl Copy, is allowed to access'aor not. In other words, it is equivalent to which of the following?or,
On stable
The behavior in current stable is consistent with the first as shown by:
Assocuses the lifetime'a, the compiler complains aboutImplementation is not general enoughas expected.It looks like this was unintentionally stabilized and changing that now would break the above test (unless we leak the fact that
impl Copycaptures'a??).On beta
#94081 makes #88236 pass but that seems to be inconsistent with the behavior in stable:
Assocuses'a, it gives ICE, see yet another ICE with HRTB and RPIT #95647.impl Copy + 'amakes the test pass. playground. And I believe adding a lifetime bound shouldn't change the semantics in this regard.Meta
stable version:
1.60.0beta version:
1.61.0-beta.3 2022-04-17 2431a974c2dcf82ba513)@rustbot label +T-Lang +A-impl-Trait