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
syntax: destructuring structs, tuple structs and tuples should be consistent #5830
I'm going to make the existing syntax consistent with .. and open a separate issue for adding .. to tuples and tuple-structs, since that's a deeper change that I don't know if I want to tackle personally.
Renominating for demilestoning. We now have consistent "ignore the rest of these elements" across all patterns except for ignoring multiple fields in tuples (and tuple-like enum variants). We can always add those parts later (it's a backwards-compatible change), and I'm not sure that 1.0 should block on adding those features.
Additionally, I think this bug should be closed in favor of a new one which is up to date with the current state of affairs.
Activity
sethfowler commentedon Apr 11, 2013
Thanks for opening this issue, @thestinger!
catamorphism commentedon May 24, 2013
Nominating for milestone 2, backwards-compatible
bblum commentedon Jun 20, 2013
this is a great issue; i endorse it
graydon commentedon Aug 22, 2013
accepted for backwards-compatible milestone
glaebhoerl commentedon Aug 22, 2013
How about
..instead of*? Already has the matches multiple fields connotation.brson commentedon Nov 1, 2013
Here's a more complete test case. The stuff that's not commented out works (and probably shouldn't), and the stuff that's commented out should.
brendanzab commentedon Nov 1, 2013
Tuples:
Structs:
brson commentedon Nov 1, 2013
If we wanted to use
*as a generic pointer deref pattern it would make the parser simpler to use...brson commentedon Nov 1, 2013
The semantics of using
..for pulling out tuples is complicated. With vectors it's (surely) just a slice.brendanzab commentedon Nov 1, 2013
I would also add that for structs its a little ugly, so yeah - not sure. Just an idea.
brson commentedon Nov 1, 2013
If we did go with
..then I would want just..to mean 'everything else', not.._.brendanzab commentedon Nov 1, 2013
You could just remove the ability you destructure the tail for tuples, and go with:
Either way, going with
..is fits nicer with vector destructuring, and reduces the amount of overloading on*, which is already under strain.nikomatsakis commentedon Nov 2, 2013
+1 for
..For that matter, in vector patterns, we could probably make the
_implicit if the next token is a comma or closing brace etc. i.e.,
[a, b, .., d]brson commentedon Nov 8, 2013
I'm going to make the existing syntax consistent with
..and open a separate issue for adding..to tuples and tuple-structs, since that's a deeper change that I don't know if I want to tackle personally.auto merge of #10366 : brson/rust/ignore-patterns, r=alexcrichton
alexcrichton commentedon Nov 29, 2013
Renominating for demilestoning. We now have consistent "ignore the rest of these elements" across all patterns except for ignoring multiple fields in tuples (and tuple-like enum variants). We can always add those parts later (it's a backwards-compatible change), and I'm not sure that 1.0 should block on adding those features.
Additionally, I think this bug should be closed in favor of a new one which is up to date with the current state of affairs.
pnkfelix commentedon Dec 19, 2013
Switching to P-low because its almost done, and the only thing(s?) remaining are back-compat and low priority for post-1.0.
alexcrichton commentedon Mar 12, 2014
Closing in favor of #10365, which is what remains to be done.
Auto merge of rust-lang#5830 - flip1995:rustup, r=flip1995
Use matches!() macro to improve readability (rust-lang#5830)