-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking issue for RFC 2302, Tuple struct construction with Self(v1, v2, ..)
#51994
Comments
…rkor Implement RFC 2302: tuple_struct_self_ctor Tracking issue: #51994
…rkor Implement RFC 2302: tuple_struct_self_ctor Tracking issue: #51994
Code that implements this has been merged. #![feature(self_struct_ctor)]
struct Example(i32, bool);
impl Example {
fn new() -> Self {
Self(42, true)
}
} |
@rfcbot merge Stabilization report & proposalFeature name: Originally accepted in rust-lang/rfcs#2302, I propose that we stabilize The proposed change is not a blocker for anyone but it is a nice quality of life feature in some cases and more importantly, it makes the language less surprising and easier to learn. Furthermore, we do already permit What is being stabilizedRelevant artefacts: The changes are:
match Self {
Self => ...
}
match Self(0, 1) {
Self(x, y) => ...
}
opt.map(Self)
What is not being stabilizedMentions of enum variants through enum Foo { Variant(u8), }
impl Foo {
fn bar() {
let x = Self::Variant(1);
}
} Divergences from RFCNone |
Team member @Centril has proposed to merge this. The next step is review by the rest of the tagged teams:
No concerns currently listed. Once a majority of reviewers approve (and none object), 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 is now entering its final comment period, as per the review above. 🔔 |
A variant of what is not being stabilized gave me an internal compiler error. Code: #![feature(self_struct_ctor)]
#![allow(dead_code)]
enum Foo {}
impl Foo {
fn bar() {
Self(1u8);
}
}
fn main() {} Compiler output:
|
@caiopsouza Thanks for reporting this! Could you file this as a separate issue so that we can track and fix it? |
… r=Centril Stabilize self_struct_ctor feature. [**Tracking Issue**](rust-lang#51994)
The final comment period, with a disposition to merge, as per the review above, is now complete. |
may I ask, in which release of rust was this merged? fixed in rustc-1.32.0, sry for the noise :-) |
In particular, we need 1.32 for rust-lang/rust#51994 and `extern crate std` due to getrandom.
This is a tracking issue for the RFC "Tuple struct construction with
Self(v1, v2, ..)
" (rust-lang/rfcs#2302).Steps:
Unresolved questions:
None
The text was updated successfully, but these errors were encountered: