Implement .. in tuple (struct) patterns (RFC 1492)#33639
Implement .. in tuple (struct) patterns (RFC 1492)#33639bors merged 4 commits intorust-lang:masterfrom
.. in tuple (struct) patterns (RFC 1492)#33639Conversation
|
Since this implements an RfC, it will need to land soon, right? In that case, we probably should make a batch soon after this gets approved -- so if you have other PRs you want to make, now is the time! |
|
☔ The latest upstream changes (presumably #33654) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Rebased. |
src/librustc/hir/mod.rs
Outdated
There was a problem hiding this comment.
Nit: s/presents/is present/
There was a problem hiding this comment.
Not that there is anything wrong with it, but I am surprised by this choice; I would have expected Vec<P<Pat>> and Option<Vec<P<Pat>>>, where the second set of patterns come after the ... Did you consider this and find that the current optional usize works out better (or just that you prefer it)? Anyway, it seems ok as is, just wanted to toss an alternative out there.
There was a problem hiding this comment.
One allocation, the variant itself is more compact (6 ptrs vs 4 ptrs), simpler traversal (no vec1.chain(vec2)).
|
Looks good. r=me with the add'l tests listed and nits addressed, though we should decide whether |
|
Updated. |
|
My vote: let's keep it illegal and thereby start conservatively. |
|
I concur with @aturon; plus both syntaxes are feature gated so even if change wasn't a conservative extension we would still be within bounds to change it later |
|
OK. Seems weird to me to permit trailing commas but only sometimes, but I bow to the will of the masses! |
|
@bors r+ |
|
📌 Commit 4983025 has been approved by |
|
D'oh, sorry @Manishearth
|
cc rust-lang#33627 r? @nikomatsakis plugin-[breaking-change] cc rust-lang#31645 @Manishearth
cc rust-lang#33627 r? @nikomatsakis plugin-[breaking-change] cc rust-lang#31645 @Manishearth
cc #33627
r? @nikomatsakis
plugin-[breaking-change] cc #31645 @Manishearth