-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
document field init shorthand #38830
Comments
yes, i am very happy to mentor anyone who needs help with this. |
I would like to pick this up. |
@HnGiang great! Please let me know if you need any assistance. |
@steveklabnik sorry for take a while to process, please help me review document in PR #39096 |
…nd-38830, r=steveklabnik Update struct_expr grammar for field init shorthand. Part of the work for rust-lang#38830 . r? @steveklabnik
What is the status of this work now? :) |
@nikomatsakis basically, until we have the bookshelf, we're not landing doc PRs until they're the last thing holding up stabilization. #39096 has some outstanding issues with it as well that need to be addressed before it's mergable. |
@steveklabnik ok. To be clear, I think that a doc PR is indeed the only thing holding up stabilization here, so once those issues are addressed, I think we ought to merge. |
Okay. so, should we be doing that right now, to land stuff before the next release? or should we be waiting until after the branch? Has the next beta been branched? |
@steveklabnik I don't care too much about whether this makes it into the next beta or not, we don't have to stress, but I would not delay either. |
I haven't been available these days due to the big holiday in my country, so I couldn't reach the topic. At the moment, I have some troubles in work and cannot fix these problems, I will ask @phungleson for help. Thanks. |
I'd like to help in this one, I don't know a lot but I'm willing to learn :) |
@z1mvader thank you! As far as docs go, #39459 has most of the work in it; maybe take a look at that and see if it makes sense to you? Leave a comment either way 😄 |
…c, r=steveklabnik Fix short hand struct doc Don't want to discredit @HnGiang effort on this issue. I just want to lend a hand to fix this issue rust-lang#38830, it is a very nice feature and is seemingly completed. Fixes rust-lang#39096 r? @steveklabnik
…c, r=steveklabnik Fix short hand struct doc Don't want to discredit @HnGiang effort on this issue. I just want to lend a hand to fix this issue rust-lang#38830, it is a very nice feature and is seemingly completed. Fixes rust-lang#39096 r? @steveklabnik
As the changelog is created always when doing releases (at least this history seems to indicate that), I think nothing needs to be changed in the Rust git repo, right? So only Rust by example remains for this issue to be resolved? |
Though not required for this, I've gone ahead and made an example, so you can mark that item as done as well! |
Stabilize field init shorthand Closes rust-lang#37340. ~Still blocked by the documentation issue rust-lang#38830.~ EDIT: seems that all parts required for stabilisation are fixed, so its not blocked.
we have both rust-lang/rust-by-example#844 and rust-lang/rust-by-example#837 so i think this is all done now! |
I know this feature is already implemented and closed. I'm trying to get it to work but fails for some reason.
extremely obvious code here. Whenever I compile and run it. I get this error:
I ran both 1.2.3 stable and nightly on this, same result. |
Yes. The shorthand lets you substitute e.g. |
Adding to that, even though this works: struct Tea(u32, u32);
fn main() {
let t = Tea {
0: 2,
1: 3,
};
} This doesn't: struct Tea(u32, u32);
fn main() {
let 0 = 2;
let 1 = 3;
let t = Tea {
0,
1,
};
} |
Generally, users.rust-lang.org or StackOverflow are better places to get help than adding more comments on closed bugs! In this case, you got an answer though :) |
RFC 1682 added "field init shorthand" (tracking issue is #37340), which allows you to use a shorthand in struct literals:
This is implemented on nightly and we would like to stabilize it, but documentation is required. Here is a list of places where the documentation would need to be updated, kindly prepared by @havvy:
I'm marking this as E-mentor, since updating these docs seems like a pretty good starter bug.
The text was updated successfully, but these errors were encountered: