Uh oh!
There was an error while loading. Please reload this page.
relax adt unsizing requirements - #80726
Conversation
rust-highfive
commented
Jan 5, 2021
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
Uh oh!
There was an error while loading. Please reload this page.
joshtriplett
commented
Jan 12, 2021
We discussed this in the @rust-lang/lang meeting today, but didn't come to any conclusions. We felt that it would help to have a little more information about what exactly this is changing, beyond an example. The example helped, but some background on what exactly was allowed before and what is allowed now (rather than just the delta from the former to the latter) would make us much more confident making this change. |
lcnr
commented
Jan 18, 2021
wasn't able to get to summarize the current status here, removing nomination and renominating after I finish the summary |
The only ADT we implement Current implementationA generic struct implements
This PRA generic struct implements
|
pnkfelix
commented
Feb 2, 2021
Thanks for the write-up, @lcnr . The T-lang design team discussed this in our meeting today. We're generally in favor of this change, but we wanted to push back on it being insta-stable. From skimming the PR, it seemed to us like there might be reasonable strategies for feature-gating this change. (Either by running old and new copies of the algorithm, or potentially switching from a boolean flag to a tri-state one when determining whether Unsize can be applied.) Can you look into putting a feature gate in here? |
lcnr
commented
Feb 3, 2021
added a feature gate, note that this means that activating I think this should mostly be a theoretical concern as |
oli-obk
commented
Feb 4, 2021
@bors r+ seems fine to me. |
bors
commented
Feb 4, 2021
📌 Commit 031cce8 has been approved by |
relax adt unsizing requirements Changes unsizing of structs in case the last struct field shares generic params with other adt fields which do not change. This change is currently insta stable and changes the language, so it at least requires a lang fcp. I feel like the current state is fairly unintuitive. An example for what's now allowed would be https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6dd331d23f5c9ffc8c978175aae2e967 ```rust struct A<T, U: ?Sized>(T, B<T, U>); // previously ERR // struct A<T, U: ?Sized>(T, B<[u32; 1], U>); // ok struct B<T, U: ?Sized>(T, U); fn main() { let x = A([0; 1], B([0; 1], [0; 1])); let y: &A<[u32; 1], [u32]> = &x; assert_eq!(y.1.1.len(), 1); } ```
Rollup of 15 pull requests Successful merges: - rust-lang#79554 (Generic associated types in trait paths) - rust-lang#80726 (relax adt unsizing requirements) - rust-lang#81307 (Handle `Span`s for byte and raw strings and add more detail ) - rust-lang#81318 (rustdoc-json: Fix has_body) - rust-lang#81456 (Make remote-test-server easier to use with new targets) - rust-lang#81497 (rustdoc: Move `display_fn` struct inside `display_fn`) - rust-lang#81500 (Remove struct_type from union output) - rust-lang#81542 (Expose correct symlink API on WASI) - rust-lang#81676 (Add more information to the error code for 'crate not found') - rust-lang#81682 (Add additional bitset benchmarks) - rust-lang#81730 (Make `Allocator` object-safe) - rust-lang#81763 (Cleanup rustdoc pass descriptions a bit) - rust-lang#81767 (Update LayoutError/LayoutErr stability attributes) - rust-lang#81771 (Indicate change in RSS from start to end of pass in time-passes output) - rust-lang#81781 (Fix `install-awscli.sh` error in CI) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…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
Changes unsizing of structs in case the last struct field shares generic params with other adt fields which do not change.
This change is currently insta stable and changes the language, so it at least requires a lang fcp. I feel like the current state is fairly unintuitive.
An example for what's now allowed would be https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6dd331d23f5c9ffc8c978175aae2e967