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
Self parameters & C-variadics should be syntactically legal in parenthesized generic argument lists #160797
Self parameters shouldn't be syntactically forbidden in this position (only semantically) since that diverges from every other place that can contain "function parameters" IINM.
We intentionally allow self parameters in e.g., function pointer types (CC #68764, rust-lang/reference#2240 (comment)) and free function items. As it stands, it means we reject X(self), X(&self), X(&mut self) but accept X(&&self), X(&&mut self) for example (the latter are rightfully legal as they're interpreted as X(_: &&self) & X(_: &&mut self) essentially1).
Similarly, for C-variadics. They should be syntactically allowed, too, IMO.
Unifying this would once again simplify the grammar; we shouldn't fight the fact that self parameters & C-variadics are (meant to be) syntactically valid fn params always.
RFC 3955 doesn't mention self parameters / C-variadics at all AFAICT. They did cross my mind when the RFC was still open but I didn't feel like discussing it given I was already submitting so many comments (arguably I should've though). However, when implementing this feature in my parser I thought about this topic again.
I did label this with T-lang but their input isn't necessary until the stabilization of this feature. Of course, this change should be noted down in the tracking issue as a divergence from the RFC, so it doesn't get lost.
Activity
fmease commentedon Aug 9, 2026
RFC 3955 doesn't mention self parameters / C-variadics at all AFAICT. They did cross my mind when the RFC was still open but I didn't feel like discussing it given I was already submitting so many comments (arguably I should've though). However, when implementing this feature in my parser I thought about this topic again.
I did label this with T-lang but their input isn't necessary until the stabilization of this feature. Of course, this change should be noted down in the tracking issue as a divergence from the RFC, so it doesn't get lost.
fmease commentedon Sep 11, 2026
#162634 will address the "self parameter" part.
fmease commentedon Oct 21, 2026
#164595 addressed attributes (not originally listed in the issue description).
JonathanBrouwer commentedon Oct 21, 2026
Is there any part of this issue that is still open?
I'll do this
fmease commentedon Oct 21, 2026
Yas, C-variadics should probably be syntactically permitted (& semantically forbidden).
JonathanBrouwer commentedon Oct 22, 2026
Right, I'll go fix that
@rustbot claim
fmease commentedon Oct 22, 2026
r? me then over @ the PR :)
Rollup merge of rust-lang#165080 - JonathanBrouwer:variadics, r=fmease
Rollup merge of rust-lang#165080 - JonathanBrouwer:variadics, r=fmease
Rollup merge of rust-lang#165080 - JonathanBrouwer:variadics, r=fmease
Unrolled build for #165080 in rollup 165151
Rollup merge of #165080 - JonathanBrouwer:variadics, r=fmease
Rollup merge of #165080 - JonathanBrouwer:variadics, r=fmease