Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for "clarified ADT kinds" (RFC 1506) #35626
Comments
nikomatsakis
added
B-RFC-approved
T-lang
B-unstable
labels
Aug 12, 2016
nikomatsakis
referenced this issue
Aug 12, 2016
Merged
Clarify the relationships between various kinds of structs and variants #1506
petrochenkov
referenced this issue
Aug 12, 2016
Merged
Implement RFC 1506 "Clarify the relationships between various kinds of structs and variants" #35138
bors
added a commit
that referenced
this issue
Aug 13, 2016
petrochenkov
referenced this issue
Sep 30, 2016
Merged
Partially stabilize RFC 1506 "Clarify relationships between ADTs" #36868
This comment has been minimized.
This comment has been minimized.
|
@rfcbot fcp merge I propose that we stabilize this feature. There are no known blockers or interactions and it is a relatively minor extension to existing syntax. I would very much welcome the ability to use |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Oct 4, 2016
•
|
FCP proposed with disposition to merge. Review requested from: No concerns currently listed. |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Oct 13, 2016
|
All relevant subteam members have reviewed. No concerns remain. |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Oct 20, 2016
|
It has been one week since all blocks to the FCP were resolved. |
nikomatsakis
added
the
final-comment-period
label
Oct 21, 2016
This comment has been minimized.
This comment has been minimized.
|
Entering FCP. Honestly I'm not clear for how long. =) Stabilizations still confuse me a bit. |
This comment has been minimized.
This comment has been minimized.
|
The release is coming up, and this has not exactly been a controversial topic, so we've decide to make it official and approve this for stabilization. |
eddyb
added a commit
to eddyb/rust
that referenced
this issue
Nov 9, 2016
nikomatsakis
removed
the
final-comment-period
label
Nov 11, 2016
This comment has been minimized.
This comment has been minimized.
|
@rfcbot fcp merge I'd like to propose that we stabilize the remaining feature in this feature-gate, numeric field names. For example, this code works now: #![feature(relaxed_adts)]
struct Foo(u32);
fn main() {
let Foo { 0: x } = Foo(22);
println!("{}", x);
} |
bluss
referenced this issue
Dec 1, 2016
Open
docs: Don't distinguish structs and tuple structs with only private fields #38101
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis It looks like the rfcbot ignored your second merge request and nobody noticed for a month. Maybe it can't handle two fcp merges on the same issue? |
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/lang, since RFC bot doesn't allow us to FCP again, I'll make the list manually. @nikomatsakis proposed to go to FCP for stabilizing the numeric field names feature. |
petrochenkov
referenced this issue
Jan 10, 2017
Closed
Remove tuple structs with inaccessible fields completely from the value namespace #902
This comment has been minimized.
This comment has been minimized.
|
See rust-lang/rfcs#902 (comment) for one more possible motivation for numeric fields in patterns. |
This comment has been minimized.
This comment has been minimized.
|
cc @withoutboats @pnkfelix -- stabilizing numeric field names? |
This comment has been minimized.
This comment has been minimized.
|
@rfcbot reviewed FWIW I personally hate this and would never use it. I think its the kind of thing we can all politely disagree about though. :-) |
This comment has been minimized.
This comment has been minimized.
|
Had we went with some of the other suggestions, |
This comment has been minimized.
This comment has been minimized.
|
All reviewed now. @rfcbot seems to be on PTO, so I'm going to manually declare that this issue is entering Final Comment Period for 3 weeks (until Feb 1). |
nikomatsakis
added
the
final-comment-period
label
Jan 11, 2017
This comment has been minimized.
This comment has been minimized.
|
Fwiw (as I already expressed in a comment on the RFC iirc), I think the |
This comment has been minimized.
This comment has been minimized.
|
And as far as I can tell, this is still not possible? (I was going to ask, "at least we don't allow declaring non-contiguous numeric fields, right?", and as far as that goes, apparently we don't.) |
This comment has been minimized.
This comment has been minimized.
|
I agree that numeric field patterns seem actively detrimental for hand-written code, but I believe the main motivation is to make life easier for various kinds of code generation by increasing overall uniformity (or, put differently, removing somewhat pedantic distinctions between kinds of |
This comment has been minimized.
This comment has been minimized.
|
Hmm. I am sympathetic but I do think there is a need to consolidate tuple/field structs into one logical structure, as well as to enable macros that work uniformly over them. I actually think we should support struct declarations like |
This comment has been minimized.
This comment has been minimized.
|
Doesn't that run into type namespace vs. value namespace issues for the constructor, for the record? I do agree that if we allow one we should also allow the other, otherwise. (As long as |
This comment has been minimized.
This comment has been minimized.
Doesn't what run into said conflicts, exactly? (I would assume that if you wrote |
This comment has been minimized.
This comment has been minimized.
I don't know, numeric fields in expressions/patterns, while mostly useless, at least refer to something already existsing and useful - fields of tuple structs. |
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov Not totally useless; it would let you replace a tuple-struct with a modified constructor, for example, without disturbing existing code. e.g. transforming pub struct Foo(pub usize);into pub struct Foo {
0: usize
}
pub fn Foo(x: usize) -> Foo { Foo { 0: x * 2 } }But anyway I don't feel a burning desire to add it. Just saying that it doesn't seem a priori out of the question to me. |
This comment has been minimized.
This comment has been minimized.
There're still tuple struct patterns |
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov true; my feeling is that those should desugar to |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis FCP complete? (Pinging since @rfcbot seems to still be on PTO for this issue.) |
This comment has been minimized.
This comment has been minimized.
|
@scottmcm Yeah, I think we're ready to stabilize; while there's been some discussion since FCP, it's mostly been clarifying technical details or motivation, rather than bringing new tradeoffs to light. |
This comment has been minimized.
This comment has been minimized.
|
cc @petrochenkov @rust-lang/compiler -- anyone want to make a quick stabilization PR that we can backport to 1.17 beta? |
This comment has been minimized.
This comment has been minimized.
|
Stabilization is a great place for a first PR. There are directions available on the forge: https://forge.rust-lang.org/stabilization-guide.html Marking this as E-easy and E-mentor. |
nikomatsakis
added
E-easy
E-mentor
labels
Mar 16, 2017
This comment has been minimized.
This comment has been minimized.
|
Ah, an important question -- has this been documented? If so, we ought to do that first. |
This comment has been minimized.
This comment has been minimized.
|
I do not believe so. |
This was referenced Apr 7, 2017
bors
added a commit
that referenced
this issue
May 25, 2017
bors
closed this
in
#41145
May 25, 2017
nikomatsakis
reopened this
May 25, 2017
nikomatsakis
closed this
May 25, 2017
This comment has been minimized.
This comment has been minimized.
|
cc #42945 |
nikomatsakis commentedAug 12, 2016
•
edited by dtolnay
Tracking issue for rust-lang/rfcs#1506.
Status:
Fully stabilized.
Stabilized by PR #41145:
Stabilized by PR #36868: