Skip to content

Commit 2dca248

Browse files
rustc_abi::Abi to IrForm in the rest of the compiler
1 parent f33fb02 commit 2dca248

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{cmp, fmt};
44

55
use rustc_abi::Primitive::{self, Float, Int, Pointer};
66
use rustc_abi::{
7-
Abi, AddressSpace, Align, FieldsShape, HasDataLayout, Integer, LayoutCalculator, LayoutS,
7+
AddressSpace, Align, FieldsShape, HasDataLayout, Integer, IrForm, LayoutCalculator, LayoutS,
88
PointeeInfo, PointerKind, ReprOptions, Scalar, Size, TagEncoding, TargetDataLayout, Variants,
99
};
1010
use rustc_error_messages::DiagMessage;
@@ -757,7 +757,7 @@ where
757757
Some(fields) => FieldsShape::Union(fields),
758758
None => FieldsShape::Arbitrary { offsets: IndexVec::new(), memory_index: IndexVec::new() },
759759
},
760-
abi: Abi::Uninhabited,
760+
ir_form: IrForm::Uninhabited,
761761
largest_niche: None,
762762
align: tcx.data_layout.i8_align,
763763
size: Size::ZERO,

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_middle::ty::util::IntTypeExt;
1313
use rustc_middle::ty::{self, Ty, UpvarArgs};
1414
use rustc_span::source_map::Spanned;
1515
use rustc_span::{DUMMY_SP, Span};
16-
use rustc_target::abi::{Abi, FieldIdx, Primitive};
16+
use rustc_target::abi::{FieldIdx, IrForm, Primitive};
1717
use tracing::debug;
1818

1919
use crate::build::expr::as_place::PlaceBase;
@@ -207,7 +207,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
207207
);
208208
let (op, ty) = (Operand::Move(discr), discr_ty);
209209

210-
if let Abi::Scalar(scalar) = layout.unwrap().abi
210+
if let IrForm::Scalar(scalar) = layout.unwrap().ir_form
211211
&& !scalar.is_always_valid(&this.tcx)
212212
&& let Primitive::Int(int_width, _signed) = scalar.primitive()
213213
{

compiler/rustc_mir_dataflow/src/value_analysis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ impl<'tcx> Map<'tcx> {
858858
// Allocate a value slot if it doesn't have one, and the user requested one.
859859
assert!(place_info.value_index.is_none());
860860
if let Ok(layout) = tcx.layout_of(param_env.and(place_info.ty))
861-
&& layout.abi.is_scalar()
861+
&& layout.ir_form.is_scalar()
862862
{
863863
place_info.value_index = Some(self.value_count.into());
864864
self.value_count += 1;

compiler/rustc_passes/src/layout_test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ fn dump_layout_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId, attr: &Attribute) {
8181
let meta_items = attr.meta_item_list().unwrap_or_default();
8282
for meta_item in meta_items {
8383
match meta_item.name_or_empty() {
84+
// FIXME: this never was about ABI and now this dump arg is confusing
8485
sym::abi => {
85-
tcx.dcx().emit_err(LayoutAbi { span, abi: format!("{:?}", ty_layout.abi) });
86+
tcx.dcx()
87+
.emit_err(LayoutAbi { span, abi: format!("{:?}", ty_layout.ir_form) });
8688
}
8789

8890
sym::align => {

compiler/rustc_smir/src/rustc_smir/convert/abi.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'tcx> Stable<'tcx>
5858
LayoutShape {
5959
fields: self.fields.stable(tables),
6060
variants: self.variants.stable(tables),
61-
abi: self.abi.stable(tables),
61+
abi: self.ir_form.stable(tables),
6262
abi_align: self.align.abi.stable(tables),
6363
size: self.size.stable(tables),
6464
}
@@ -202,20 +202,20 @@ impl<'tcx> Stable<'tcx> for rustc_abi::TagEncoding<rustc_target::abi::VariantIdx
202202
}
203203
}
204204

205-
impl<'tcx> Stable<'tcx> for rustc_abi::Abi {
205+
impl<'tcx> Stable<'tcx> for rustc_abi::IrForm {
206206
type T = ValueAbi;
207207

208208
fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
209209
match *self {
210-
rustc_abi::Abi::Uninhabited => ValueAbi::Uninhabited,
211-
rustc_abi::Abi::Scalar(scalar) => ValueAbi::Scalar(scalar.stable(tables)),
212-
rustc_abi::Abi::ScalarPair(first, second) => {
210+
rustc_abi::IrForm::Uninhabited => ValueAbi::Uninhabited,
211+
rustc_abi::IrForm::Scalar(scalar) => ValueAbi::Scalar(scalar.stable(tables)),
212+
rustc_abi::IrForm::ScalarPair(first, second) => {
213213
ValueAbi::ScalarPair(first.stable(tables), second.stable(tables))
214214
}
215-
rustc_abi::Abi::Vector { element, count } => {
215+
rustc_abi::IrForm::Vector { element, count } => {
216216
ValueAbi::Vector { element: element.stable(tables), count }
217217
}
218-
rustc_abi::Abi::Aggregate { sized } => ValueAbi::Aggregate { sized },
218+
rustc_abi::IrForm::Memory { sized } => ValueAbi::Aggregate { sized },
219219
}
220220
}
221221
}

compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_middle::ty::{
1818
};
1919
use rustc_span::Span;
2020
use rustc_span::symbol::Symbol;
21-
use rustc_target::abi::Abi;
21+
use rustc_target::abi::IrForm;
2222
use smallvec::SmallVec;
2323
use tracing::{debug, instrument};
2424

@@ -523,8 +523,8 @@ fn check_receiver_correct<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, method:
523523

524524
// e.g., `Rc<()>`
525525
let unit_receiver_ty = receiver_for_self_ty(tcx, receiver_ty, tcx.types.unit, method_def_id);
526-
match tcx.layout_of(param_env.and(unit_receiver_ty)).map(|l| l.abi) {
527-
Ok(Abi::Scalar(..)) => (),
526+
match tcx.layout_of(param_env.and(unit_receiver_ty)).map(|l| l.ir_form) {
527+
Ok(IrForm::Scalar(..)) => (),
528528
abi => {
529529
tcx.dcx().span_delayed_bug(
530530
tcx.def_span(method_def_id),
@@ -538,8 +538,8 @@ fn check_receiver_correct<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, method:
538538
// e.g., `Rc<dyn Trait>`
539539
let trait_object_receiver =
540540
receiver_for_self_ty(tcx, receiver_ty, trait_object_ty, method_def_id);
541-
match tcx.layout_of(param_env.and(trait_object_receiver)).map(|l| l.abi) {
542-
Ok(Abi::ScalarPair(..)) => (),
541+
match tcx.layout_of(param_env.and(trait_object_receiver)).map(|l| l.ir_form) {
542+
Ok(IrForm::ScalarPair(..)) => (),
543543
abi => {
544544
tcx.dcx().span_delayed_bug(
545545
tcx.def_span(method_def_id),

0 commit comments

Comments
 (0)