1
Fork 0

Auto merge of #109915 - scottmcm:layout-indexvec, r=oli-obk

Use `FieldIdx` in `FieldsShape`

Finally got to the main motivating example from https://github.com/rust-lang/compiler-team/issues/606 :)
This commit is contained in:
bors 2023-04-06 07:38:58 +00:00
commit 2824db39f1
7 changed files with 132 additions and 100 deletions

View file

@ -5,6 +5,7 @@ use crate::ty::{self, ReprOptions, Ty, TyCtxt, TypeVisitableExt};
use rustc_errors::{DiagnosticBuilder, Handler, IntoDiagnostic};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_index::vec::IndexVec;
use rustc_session::config::OptLevel;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::{Span, DUMMY_SP};
@ -635,7 +636,7 @@ where
variants: Variants::Single { index: variant_index },
fields: match NonZeroUsize::new(fields) {
Some(fields) => FieldsShape::Union(fields),
None => FieldsShape::Arbitrary { offsets: vec![], memory_index: vec![] },
None => FieldsShape::Arbitrary { offsets: IndexVec::new(), memory_index: IndexVec::new() },
},
abi: Abi::Uninhabited,
largest_niche: None,