Description
Promote rustc_middle::mir::Field
to rustc_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
to FieldIdx
in rustc_abi
, to be used in more places.
For example, FieldsShape::Arbitrary
maps from "source order field indices", but are currently ordinary Vec
s. With this change, offsets
would become IndexVec<FieldIdx, Size>
(instead of Vec<Size>
).
Similarly, ty::VariantDef
, despite being in the same crate as the existing mir::Field
, holds a Vec<FieldDef>
. After this MCP, that would move to IndexVec<FieldIdx, FieldDef>
.
There are more as well, such as, CustomCoerceUnsized::Struct
"Records the index of the field being coerced", but is currently storing a u32
, and could move to FieldIdx
.
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:
- File an issue describing the proposal.
- A compiler team member or contributor who is knowledgeable in the area can second by writing
@rustbot second
.- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
-C flag
, then full team check-off is required. - Compiler team members can initiate a check-off via
@rfcbot fcp merge
on either the MCP or the PR.
- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
- Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.
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.