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 https://github.com/rust-lang/compiler-team/issues/606
This commit is contained in:
parent
10338571cf
commit
4abb455529
47 changed files with 127 additions and 104 deletions
|
@ -5,6 +5,7 @@ use rustc_middle::ty::{self, Article, FloatTy, IntTy, Ty, TyCtxt, TypeVisitableE
|
|||
use rustc_session::lint;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::{Symbol, DUMMY_SP};
|
||||
use rustc_target::abi::FieldIdx;
|
||||
use rustc_target::asm::{InlineAsmReg, InlineAsmRegClass, InlineAsmRegOrRegClass, InlineAsmType};
|
||||
|
||||
pub struct InlineAsmCtxt<'a, 'tcx> {
|
||||
|
@ -82,7 +83,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
|
|||
}
|
||||
ty::Adt(adt, substs) if adt.repr().simd() => {
|
||||
let fields = &adt.non_enum_variant().fields;
|
||||
let elem_ty = fields[0].ty(self.tcx, substs);
|
||||
let elem_ty = fields[FieldIdx::from_u32(0)].ty(self.tcx, substs);
|
||||
match elem_ty.kind() {
|
||||
ty::Never | ty::Error(_) => return None,
|
||||
ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue