-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diagnostics for @ ..
idiom use in tuple and tuple struct patterns is incorrect
#72574
Comments
rust/src/librustc_ast_lowering/pat.rs Lines 78 to 80 in f93bb2a
This rust/src/librustc_ast_lowering/pat.rs Lines 255 to 266 in f93bb2a
|
Perhaps it's worth supporting "tuple slicing" pattern too in Rust:
|
@leonardo-m that would implicitly create a tuple for |
That syntax is meant to produce a shorter tuple xs with the omission of the first item of the tuple. lf you think it's an useless idea then let's ignore it :) |
@rustbot claim |
@estebank and I are working on diagnostics for the
@ ..
rest idiom in slice patterns (#72534) and came across this issue when an attempt is made to use it in tuples and tuple structs.IIUC, this is allowed:
tuple (playground)
tuple struct (playground)
and this is not allowed (note the addition of
[id] @
):tuple (playground)
tuple struct (playground)
The error messages for the tuple and tuple struct cases include the following incorrect information:
This should state that the
@ ..
id binding to rest is not allowed...
patterns are allowed.@ ..
is only allowed in slice patterns, not in tuple or tuple struct patterns. This should state that the idiom is only allowed in slice patterns.The text was updated successfully, but these errors were encountered: