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 Self and associated types in struct expressions and patterns #37544
Comments
petrochenkov
referenced this issue
Nov 3, 2016
Merged
Feature gate Self and associated types in struct expressions and patterns #37547
This comment has been minimized.
This comment has been minimized.
|
This doesn't feel complete to me without also allowing I was looking forward to this feature, so I don't have to repeat type names in as many places, but in its current state this is too inconsistent to be widely applicable. |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
I don't want to get off-topic here, but I find it odd that a type alias does not give you the full capabilities that you can do when using the original type name. When one says |
This comment has been minimized.
This comment has been minimized.
It's possible, just messy.
It may a function call, or it may be a tuple struct construction. If the "type itself" is used for looking up tuple struct constructors, then we need:
Instead of doing all this, tuple/unit structs define additional function/constant-like items in value namespace which then used during resolution of |
bors
added a commit
that referenced
this issue
Nov 5, 2016
jonathandturner
added a commit
to jonathandturner/rust
that referenced
this issue
Nov 5, 2016
bors
added a commit
that referenced
this issue
Nov 5, 2016
bors
added a commit
that referenced
this issue
Nov 5, 2016
bors
added a commit
that referenced
this issue
Nov 5, 2016
bors
added a commit
that referenced
this issue
Nov 5, 2016
bors
added a commit
that referenced
this issue
Nov 6, 2016
bors
added a commit
that referenced
this issue
Nov 6, 2016
petrochenkov
referenced this issue
Nov 12, 2016
Closed
Stabilize Self and associated types in struct expressions and patterns #37734
nikomatsakis
added
B-RFC-approved
B-unstable
T-lang
B-RFC-implemented
labels
Nov 14, 2016
This comment has been minimized.
This comment has been minimized.
|
@rfcbot fcp merge I propose that we stabilize this tracking issue. This is the feature which allows you to use My main concern is that perhaps it is confusing to allow types (and not just structs) at all! I am open to the possibility of letting this bake a little longer and not moving to FCP. |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Nov 14, 2016
•
|
Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This comment has been minimized.
This comment has been minimized.
|
I like this feature and even look forward to having it integrated with variant types! |
This comment has been minimized.
This comment has been minimized.
This is my concern too, however, my understanding is that this ship sailed some time ago and we allow all sorts of things in the ident position of a struct literal. |
This comment has been minimized.
This comment has been minimized.
Off hand I'm not sure what you mean... have an example? Do we allow e.g. type aliases? |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis We do allow type aliases and this is what I had in mind. FWIW, we also allow, e.g., |
This comment has been minimized.
This comment has been minimized.
|
So in particular this does work: struct Foo<T> { x: T }
type Bar = Foo<u32>;
fn main() {
let x = Bar { x: 22 };
} |
This comment has been minimized.
This comment has been minimized.
|
@rfcbot reviewed |
This comment has been minimized.
This comment has been minimized.
|
ping @nikomatsakis |
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov We can backport the stabilization. Looks like this was blocked on @pnkfelix who's been on vacation. I'll try to get a hold of him now. |
This comment has been minimized.
This comment has been minimized.
|
@rfcbot reviewed |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Dec 20, 2016
|
psst @nikomatsakis, I wasn't able to add the |
nrc
added
the
final-comment-period
label
Dec 21, 2016
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Jan 23, 2017
|
The final comment period is now complete. |
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov you want to prepare stabilization PR? |
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov you want to prepare stabilization PR? |
petrochenkov commentedNov 3, 2016
I'm going to add a feature gate according to #37035 (comment), this is a corresponding tracking issue.