Auto merge of #109849 - scottmcm:more-fieldidx-rebase, r=oli-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 https://github.com/rust-lang/compiler-team/issues/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 https://github.com/rust-lang/rust/pull/109787
This commit is contained in:
commit
a93bcdc307
13 changed files with 51 additions and 46 deletions
|
@ -16,6 +16,7 @@ use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
|||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir};
|
||||
use rustc_hir::{self, GeneratorKind};
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
|
||||
use rustc_ast::Mutability;
|
||||
|
@ -1125,7 +1126,7 @@ pub enum Rvalue<'tcx> {
|
|||
///
|
||||
/// Disallowed after deaggregation for all aggregate kinds except `Array` and `Generator`. After
|
||||
/// generator lowering, `Generator` aggregate kinds are disallowed too.
|
||||
Aggregate(Box<AggregateKind<'tcx>>, Vec<Operand<'tcx>>),
|
||||
Aggregate(Box<AggregateKind<'tcx>>, IndexVec<FieldIdx, Operand<'tcx>>),
|
||||
|
||||
/// Transmutes a `*mut u8` into shallow-initialized `Box<T>`.
|
||||
///
|
||||
|
@ -1186,7 +1187,7 @@ pub enum AggregateKind<'tcx> {
|
|||
/// active field number and is present only for union expressions
|
||||
/// -- e.g., for a union expression `SomeUnion { c: .. }`, the
|
||||
/// active field index would identity the field `c`
|
||||
Adt(DefId, VariantIdx, SubstsRef<'tcx>, Option<UserTypeAnnotationIndex>, Option<usize>),
|
||||
Adt(DefId, VariantIdx, SubstsRef<'tcx>, Option<UserTypeAnnotationIndex>, Option<FieldIdx>),
|
||||
|
||||
Closure(DefId, SubstsRef<'tcx>),
|
||||
Generator(DefId, SubstsRef<'tcx>, hir::Movability),
|
||||
|
@ -1263,7 +1264,7 @@ pub enum BinOp {
|
|||
mod size_asserts {
|
||||
use super::*;
|
||||
// tidy-alphabetical-start
|
||||
static_assert_size!(AggregateKind<'_>, 40);
|
||||
static_assert_size!(AggregateKind<'_>, 32);
|
||||
static_assert_size!(Operand<'_>, 24);
|
||||
static_assert_size!(Place<'_>, 16);
|
||||
static_assert_size!(PlaceElem<'_>, 24);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue