summaryrefslogtreecommitdiff
path: root/compiler/rustc_mir_dataflow
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2023-03-28 12:32:57 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2023-03-28 22:22:37 -0700
commit5bbaeadc013cae79e440fb5d3da2175c83cb36e4 (patch)
tree1a319e386a0404732c47890dfff6be7b9c11706c /compiler/rustc_mir_dataflow
parentacd27bb5572553a4dc9a2d6f21d9a3a68ff8a233 (diff)
downloadrust-5bbaeadc013cae79e440fb5d3da2175c83cb36e4.tar.gz
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.
Diffstat (limited to 'compiler/rustc_mir_dataflow')
-rw-r--r--compiler/rustc_mir_dataflow/src/elaborate_drops.rs18
-rw-r--r--compiler/rustc_mir_dataflow/src/value_analysis.rs6
2 files changed, 12 insertions, 12 deletions
diff --git a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs b/compiler/rustc_mir_dataflow/src/elaborate_drops.rs
index fe6728fc76e..37787d99c2d 100644
--- a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs
+++ b/compiler/rustc_mir_dataflow/src/elaborate_drops.rs
@@ -7,7 +7,7 @@ use rustc_middle::traits::Reveal;
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::util::IntTypeExt;
use rustc_middle::ty::{self, Ty, TyCtxt};
-use rustc_target::abi::{VariantIdx, FIRST_VARIANT};
+use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
use std::{fmt, iter};
/// The value of an inserted drop flag.
@@ -129,7 +129,7 @@ pub trait DropElaborator<'a, 'tcx>: fmt::Debug {
/// Returns the subpath of a field of `path` (or `None` if there is no dedicated subpath).
///
/// If this returns `None`, `field` will not get a dedicated drop flag.
- fn field_subpath(&self, path: Self::Path, field: Field) -> Option<Self::Path>;
+ fn field_subpath(&self, path: Self::Path, field: FieldIdx) -> Option<Self::Path>;
/// Returns the subpath of a dereference of `path` (or `None` if there is no dedicated subpath).
///
@@ -269,7 +269,7 @@ where
.iter()
.enumerate()
.map(|(i, f)| {
- let field = Field::new(i);
+ let field = FieldIdx::new(i);
let subpath = self.elaborator.field_subpath(variant_path, field);
let tcx = self.tcx();
@@ -397,8 +397,8 @@ where
.enumerate()
.map(|(i, &ty)| {
(
- self.tcx().mk_place_field(self.place, Field::new(i), ty),
- self.elaborator.field_subpath(self.path, Field::new(i)),
+ self.tcx().mk_place_field(self.place, FieldIdx::new(i), ty),
+ self.elaborator.field_subpath(self.path, FieldIdx::new(i)),
)
})
.collect();
@@ -416,9 +416,9 @@ where
unique_ty.ty_adt_def().unwrap().non_enum_variant().fields[0].ty(self.tcx(), substs);
let ptr_ty = self.tcx().mk_imm_ptr(substs[0].expect_ty());
- let unique_place = self.tcx().mk_place_field(self.place, Field::new(0), unique_ty);
- let nonnull_place = self.tcx().mk_place_field(unique_place, Field::new(0), nonnull_ty);
- let ptr_place = self.tcx().mk_place_field(nonnull_place, Field::new(0), ptr_ty);
+ let unique_place = self.tcx().mk_place_field(self.place, FieldIdx::new(0), unique_ty);
+ let nonnull_place = self.tcx().mk_place_field(unique_place, FieldIdx::new(0), nonnull_ty);
+ let ptr_place = self.tcx().mk_place_field(nonnull_place, FieldIdx::new(0), ptr_ty);
let interior = self.tcx().mk_place_deref(ptr_place);
let interior_path = self.elaborator.deref_subpath(self.path);
@@ -899,7 +899,7 @@ where
.iter()
.enumerate()
.map(|(i, f)| {
- let field = Field::new(i);
+ let field = FieldIdx::new(i);
let field_ty = f.ty(tcx, substs);
Operand::Move(tcx.mk_place_field(self.place, field, field_ty))
})
diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs
index 7f560d61194..63e553bec53 100644
--- a/compiler/rustc_mir_dataflow/src/value_analysis.rs
+++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs
@@ -40,7 +40,7 @@ use rustc_index::vec::IndexVec;
use rustc_middle::mir::visit::{MutatingUseContext, PlaceContext, Visitor};
use rustc_middle::mir::*;
use rustc_middle::ty::{self, Ty, TyCtxt};
-use rustc_target::abi::VariantIdx;
+use rustc_target::abi::{FieldIdx, VariantIdx};
use crate::lattice::{HasBottom, HasTop};
use crate::{
@@ -919,7 +919,7 @@ impl<V: HasTop> ValueOrPlace<V> {
/// Although only field projections are currently allowed, this could change in the future.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum TrackElem {
- Field(Field),
+ Field(FieldIdx),
Variant(VariantIdx),
Discriminant,
}
@@ -941,7 +941,7 @@ pub fn iter_fields<'tcx>(
ty: Ty<'tcx>,
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
- mut f: impl FnMut(Option<VariantIdx>, Field, Ty<'tcx>),
+ mut f: impl FnMut(Option<VariantIdx>, FieldIdx, Ty<'tcx>),
) {
match ty.kind() {
ty::Tuple(list) => {