-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add rustc_abi::FieldIdx
#606
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. cc @rust-lang/compiler @rust-lang/compiler-contributors |
@rustbot second |
The first PR for rust-lang/compiler-team#606 This is just the move-and-rename, because it's plenty big-and-bitrotty already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
Move `mir::Field` → `abi::FieldIdx` The first PR for rust-lang/compiler-team#606 This is just the move-and-rename, because it's plenty big already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of rust-lang/compiler-team#606
…leLapkin Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>` And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of rust-lang/compiler-team#606
Add `IndexSlice` to go with `IndexVec` Moves the methods that don't need full `IndexVec`-ness over to `IndexSlice`, and have `IndexVec` deref to `IndexSlice` so everything keeps working. Doing this for later use in rust-lang/compiler-team#606, where I'm hitting a bunch of things that are just slices and thus there's no way to index with the `FieldIdx`.
…-obk Use `FieldIdx` in various things related to aggregates Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`. Part 3/? of rust-lang/compiler-team#606 [`IndexSlice`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_index/vec/struct.IndexVec.html#deref-methods-IndexSlice%3CI,+T%3E) was added in rust-lang#109787
Add `IndexSlice` to go with `IndexVec` Moves the methods that don't need full `IndexVec`-ness over to `IndexSlice`, and have `IndexVec` deref to `IndexSlice` so everything keeps working. Doing this for later use in rust-lang/compiler-team#606, where I'm hitting a bunch of things that are just slices and thus there's no way to index with the `FieldIdx`.
It's been 10 days since the second, so I'm closing this as approved. (And in fact work is already in-progress towards it.) |
Use `FieldIdx` in `FieldsShape` Finally got to the main motivating example from rust-lang/compiler-team#606 :)
The first PR for rust-lang/compiler-team#606 This is just the move-and-rename, because it's plenty big-and-bitrotty already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
Move `mir::Field` → `abi::FieldIdx` The first PR for rust-lang/compiler-team#606 This is just the move-and-rename, because it's plenty big already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of rust-lang/compiler-team#606
Use `FieldIdx` in `FieldsShape` Finally got to the main motivating example from rust-lang/compiler-team#606 :)
Various minor Idx-related tweaks Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify. cc rust-lang/compiler-team#606 r? `@WaffleLapkin`
Promote
rustc_middle::mir::Field
torustc_abi::FieldIdx
Proposal
We have
VariantIdx
that's used broadly for source-order variants.mir::Field
exists, but is not used pervasively -- it's basically just in projections.This MCP proposes uplifting
mir::Field
toFieldIdx
inrustc_abi
, to be used in more places.For example,
FieldsShape::Arbitrary
maps from "source order field indices", but are currently ordinaryVec
s. With this change,offsets
would becomeIndexVec<FieldIdx, Size>
(instead ofVec<Size>
).Similarly,
ty::VariantDef
, despite being in the same crate as the existingmir::Field
, holds aVec<FieldDef>
. After this MCP, that would move toIndexVec<FieldIdx, FieldDef>
.There are more as well, such as,
CustomCoerceUnsized::Struct
"Records the index of the field being coerced", but is currently storing au32
, and could move toFieldIdx
.Mentors or Reviewers
This is fairly straight-forward (but changes types enough to be worth an MCP, I thought) so I'm confident I can do it un-mentored.
I don't have any particular reviewer in mind.
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: