-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 2528: type-changing struct update syntax #86555
Comments
It looks like this has been implemented; are there any further known issues or blockers with it? |
I'm eagerly awaiting stabilisation of this feature! Is there anything that still needs to be done? |
Yes, i created #101970 to track it |
This feature would be useful in bootloader development when different stages of bootloading would handover structures with small modifications. For example, bootstrap module would provide main function like: fn main(param: Parameters) -> Handover {
// ....
} where fn main(param: Parameters) -> Handover {
let serial = Serial::new(param.uart0, /* ... */);
// ....
Handover { serial, ..param }
// instead of: Handover { serial, periph_1: param.periph_1, periph_2: param.periph_2, periph_3: param.periph_3, /* ... */ }
} We can now avoid repeat passing peripheral fields in bootload stage handovering, where there would typically be dozens of peripheral fields whose ownerships are going to be transfered. I'll express my idea in playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7fb79bb65cce97cc785b78d9aca1e656 In this way, type changing struct update syntax will have an obvious code size reduction, which will help a lot in embedded development. |
@luojia65 This feature is only for changing the generic arguments of the struct, e.g: going from What you want sound like what's in the Rationales and Alternatives section of the RFC for this feature, except that it doesn't talk about going between structs with an intersection of fields. |
This would work nicely with the arg struct pattern to allow providing default arguments for functions that take closures
|
This is a tracking issue for RFC 2528 (rust-lang/rfcs#2528), type-changing struct update syntax.
The feature gate for the issue will be
#![feature(type_changing_struct_update)]
.There is a dedicated Zulip stream:
#project-type-changing-struct-update
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
type_changing_struct_update
#101970Unresolved Questions
"Further generalization" in the RFC would be the subject of future RFCs, not something we need to track in this tracking issue.
Implementation history
type_changing_struct_update
#89730The text was updated successfully, but these errors were encountered: