-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
offset_of: don't require type to be Sized
#112069
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
ef34b27
to
bd587fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with the nit below
This comment has been minimized.
This comment has been minimized.
Hmm, it looks like these tests are testing things that the RFC currently disallows 🤔 |
The RFC is intentionally limited to allow a pure library implementation. My implementation also included several of the future possibilities, including supporting DSTs. |
I don't think there are any implementation concerns with allowing unsized fields, so there's no reason not to. |
Yeah the ability to get the offset of fields that are part of the sized prelude of an unsized type would be great. This is one of the things that is impossible to do (in a sound way) in libraries but it is needed by the users of one of the projects I maintain. |
bd587fd
to
4b1b9a1
Compare
4b1b9a1
to
6c18d1e
Compare
Sized
@bors r+ |
…r=WaffleLapkin offset_of: don't require type to be `Sized` Fixes rust-lang#112051 ~~The RFC [explicitly forbids](https://rust-lang.github.io/rfcs/3308-offset_of.html#limitations) non-`Sized` types, but it looks like only the fields being recursed into were checked. The sized check also seemed to have been completely missing for tuples~~
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#112031 (Migrate `item_proc_macro` to Askama) - rust-lang#112053 (Remove `-Zcgu-partitioning-strategy`.) - rust-lang#112069 (offset_of: don't require type to be `Sized`) - rust-lang#112084 (enhancements on build_helper utilization and rustdoc-gui-test) - rust-lang#112096 (Remove array_zip) - rust-lang#112108 (Fix re-export of doc hidden item inside private item not displayed) - rust-lang#112113 (rustdoc: simplify `clean` by removing `FnRetTy`) r? `@ghost` `@rustbot` modify labels: rollup
Fixes #112051
The RFC explicitly forbids non-Sized
types, but it looks like only the fields being recursed into were checked. The sized check also seemed to have been completely missing for tuples