Move mir::Field
→ abi::FieldIdx
The first PR for https://github.com/rust-lang/compiler-team/issues/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.
This commit is contained in:
parent
acd27bb557
commit
5bbaeadc01
46 changed files with 192 additions and 157 deletions
|
@ -26,7 +26,7 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
|
|||
tag_encoding: TagEncoding::Direct,
|
||||
variants: _,
|
||||
} => {
|
||||
let ptr = place.place_field(fx, mir::Field::new(tag_field));
|
||||
let ptr = place.place_field(fx, FieldIdx::new(tag_field));
|
||||
let to = layout.ty.discriminant_for_variant(fx.tcx, variant_index).unwrap().val;
|
||||
let to = if ptr.layout().abi.is_signed() {
|
||||
ty::ScalarInt::try_from_int(
|
||||
|
@ -47,7 +47,7 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
|
|||
variants: _,
|
||||
} => {
|
||||
if variant_index != untagged_variant {
|
||||
let niche = place.place_field(fx, mir::Field::new(tag_field));
|
||||
let niche = place.place_field(fx, FieldIdx::new(tag_field));
|
||||
let niche_type = fx.clif_type(niche.layout().ty).unwrap();
|
||||
let niche_value = variant_index.as_u32() - niche_variants.start().as_u32();
|
||||
let niche_value = (niche_value as u128).wrapping_add(niche_start);
|
||||
|
@ -107,7 +107,7 @@ pub(crate) fn codegen_get_discriminant<'tcx>(
|
|||
let cast_to = fx.clif_type(dest_layout.ty).unwrap();
|
||||
|
||||
// Read the tag/niche-encoded discriminant from memory.
|
||||
let tag = value.value_field(fx, mir::Field::new(tag_field));
|
||||
let tag = value.value_field(fx, FieldIdx::new(tag_field));
|
||||
let tag = tag.load_scalar(fx);
|
||||
|
||||
// Decode the discriminant (specifically if it's niche-encoded).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue