You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nested RPIT and HRTB: unclear semantics and future incompatibility #96194
It is undocumented whether the inner existential type, impl Copy, is allowed to access 'a or not. In other words, it is equivalent to which of the following?
It looks like this was unintentionally stabilized and changing that now would break the above test (unless we leak the fact that impl Copy captures 'a ??).
On beta
#94081 makes #88236 pass but that seems to be inconsistent with the behavior in stable:
Using the above test on the return type fails, which is quite surprising since removing the lifetime from impl Copy + 'a makes the test pass. playground. And I believe adding a lifetime bound shouldn't change the semantics in this regard.
It would be a backward compatibility risk if we ever want to reject the code in the future.
cc @nikomatsakis / @jackh726 for lack of better contacts in still-forming traits team, this is potentially another issue that is good to urgently-ish take a look at as an accidental stabilization.
Dropping the lang nomination. It doesn't seem clear that there is an active need for lang feedback on this issue, or at least the question is unclear -- @oli-obk (as the nominator), if there is something pending here that needs lang action, can you provide a specific question? In general having short and succinct questions accompanying nominations rather than just nominating an issue expedites in-meeting review.
Activity
aliemjay commentedon Apr 20, 2022
Just now found out that nested impl Trait in argument position are allowed 🙈
and it actually desugars to
instead of:
Now I believe this is a strong argument to reject
impl for<'a> Tr<'a, Assoc = impl Copy + 'a>in return position!aliemjay commentedon May 10, 2022
It would be unfortunate if it hits stable with such ambiguous semantics before the language team decides on the issue.
Compiler team might want to intervene in this case.
@rustbot label T-compiler I-prioritize
inquisitivecrystal commentedon May 10, 2022
@oli-obk: I just wanted to check, was this intended to be stabilized?Edit: sorry, I didn't see the internals link! That makes it clear that it was unintentional.
Mark-Simulacrum commentedon May 10, 2022
cc @nikomatsakis / @jackh726 for lack of better contacts in still-forming traits team, this is potentially another issue that is good to urgently-ish take a look at as an accidental stabilization.
apiraino commentedon May 11, 2022
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.
@rustbot label -I-prioritize +P-critical
oli-obk commentedon May 12, 2022
Summarizing the status:
Given
And the following impl
Then
fstack overflows on stable and is accepted on betawhile
f1stack works on stable and on betabut with (using the lifetime in the assoc type)
then
f2stack overflows on stable and ICEs on betathen
f3stack errors on stable and ICEs on betaIn table form
fn f() -> impl for<'a> Tr<'a, Assoc = impl Copy + 'a> {}fn f1() -> impl for<'a> Tr<'a, Assoc = impl Copy> {}fn f2() -> impl for<'a> Tr<'a, Assoc = impl Copy + 'a> { 42_i32 }fn f3() -> impl for<'a> Tr<'a, Assoc = impl Copy> { 42_i32 }5 remaining items
Mark-Simulacrum commentedon Jun 14, 2022
Dropping the lang nomination. It doesn't seem clear that there is an active need for lang feedback on this issue, or at least the question is unclear -- @oli-obk (as the nominator), if there is something pending here that needs lang action, can you provide a specific question? In general having short and succinct questions accompanying nominations rather than just nominating an issue expedites in-meeting review.
pnkfelix commentedon Nov 11, 2022
Discussed in P-high review meeting.
This is no longer a stability hazard, because we removed support for the questionable syntax .
@rustbot label -P-high
pnkfelix commentedon Nov 11, 2022
(Whoops, I didn't meant to close this; I'll let @oli-obk do that if they end up opening a separate tracking issue)
oli-obk commentedon Nov 11, 2022
Closing in favour of #104288