-
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 relaxed struct unsizing rules #81793
Comments
…sue, r=camelid update tracking issue for `relaxed_struct_unsize` forgot to do this before rust-lang#80726 got merged. The tracking issue is rust-lang#81793
…sue, r=camelid update tracking issue for `relaxed_struct_unsize` forgot to do this before rust-lang#80726 got merged. The tracking issue is rust-lang#81793
Nominating this feature for stabilization. I don't see much use in keeping this unstable and consider this change to be a simplification and improvement of our current rules. The two relevant tests here are https://github.com/rust-lang/rust/blob/master/src/test/ui/unsized/unchanged-param.rs and #88357. |
Stabilization reportThis is the stabilization report for Summary and ExplanationA generic struct previously implemented
With this feature gate the requirements are changed to:
Example#![feature(relaxed_struct_unsize)]
struct A<T, U: ?Sized + 'static>(T, B<T, U>);
struct B<T, U: ?Sized>(T, U);
fn main() {
let x: A<[u32; 1], [u32; 1]> = A([0; 1], B([0; 1], [0; 1]));
// This previously did not work as the last field of `A` also mentions `T`,
// as only `U` changes this is now allowed thanks to this feature.
let _y: &A<[u32; 1], [u32]> = &x;
} MotivationThis feature changes the existing rules to be more intuitive and more permissive. We also assume it to not cause any future compatibility issues as there is no known sensible improvement to struct unsizing which is prevented by this change. An example where the current rules are inadequate which is fixed with this feature: playground // you can unsize `U` without this feature, but
struct A<T, U: ?Sized + 'static>(T, T, U);
// after extracting the last 2 fields, you cannot unsize `U` anymore.
struct A<T, U: ?Sized + 'static>(T, B<T, U>);
struct B<T, U: ?Sized + 'static>(T, U); Unsizing is a fairly unknown area of Rust where mistakes cause very unhelpful errors. This makes improvements to its rules especially worthwhile. |
@rfcbot fcp merge |
Team member @pnkfelix has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), 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. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
The feature gate for the issue is
#![feature(relaxed_struct_unsize)]
.This features changes the when a struct implements
Unsize
whichis required for unsize coercion.
A generic struct previously implemented
Unsize
if and only if:Unsize
from source to targetWith this feature gate the requirements are changed to:
Unsize
from source to targetAbout 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
Implementation history
This feature has been implemented in #80726
The text was updated successfully, but these errors were encountered: