Skip to content

Rename ty::TyKind to ty::TyData, Ty::kind to Ty::data #77768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
@@ -307,7 +307,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
use rustc_ast::UintTy::*;
use rustc_middle::ty::{Int, Uint};

let new_kind = match ty.kind() {
let new_kind = match ty.data() {
Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.ptr_width)),
Uint(t @ Usize) => Uint(t.normalize(self.tcx.sess.target.ptr_width)),
t @ (Uint(_) | Int(_)) => t.clone(),
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/consts.rs
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ fn check_and_apply_linkage(
// extern "C" fn() from being non-null, so we can't just declare a
// static and call it a day. Some linkages (like weak) will make it such
// that the static actually has a null value.
let llty2 = if let ty::RawPtr(ref mt) = ty.kind() {
let llty2 = if let ty::RawPtr(ref mt) = ty.data() {
cx.layout_of(mt.ty).llvm_type(cx)
} else {
cx.sess().span_fatal(
38 changes: 19 additions & 19 deletions compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
@@ -343,7 +343,7 @@ fn fixed_vec_metadata(

let (size, align) = cx.size_and_align_of(array_or_slice_type);

let upper_bound = match array_or_slice_type.kind() {
let upper_bound = match array_or_slice_type.data() {
ty::Array(_, len) => len.eval_usize(cx.tcx, ty::ParamEnv::reveal_all()) as c_longlong,
_ => -1,
};
@@ -432,7 +432,7 @@ fn subroutine_type_metadata(

let signature_metadata: Vec<_> = iter::once(
// return type
match signature.output().kind() {
match signature.output().data() {
ty::Tuple(ref tys) if tys.is_empty() => None,
_ => Some(type_metadata(cx, signature.output(), span)),
},
@@ -472,7 +472,7 @@ fn trait_pointer_metadata(
// type is assigned the correct name, size, namespace, and source location.
// However, it does not describe the trait's methods.

let containing_scope = match trait_type.kind() {
let containing_scope = match trait_type.data() {
ty::Dynamic(ref data, ..) => {
data.principal_def_id().map(|did| get_namespace_for_item(cx, did))
}
@@ -572,7 +572,7 @@ pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Sp

debug!("type_metadata: {:?}", t);

let ptr_metadata = |ty: Ty<'tcx>| match *ty.kind() {
let ptr_metadata = |ty: Ty<'tcx>| match *ty.data() {
ty::Slice(typ) => Ok(vec_slice_metadata(cx, t, typ, unique_type_id, usage_site_span)),
ty::Str => Ok(vec_slice_metadata(cx, t, cx.tcx.types.u8, unique_type_id, usage_site_span)),
ty::Dynamic(..) => Ok(MetadataCreationResult::new(
@@ -592,7 +592,7 @@ pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Sp
}
};

let MetadataCreationResult { metadata, already_stored_in_typemap } = match *t.kind() {
let MetadataCreationResult { metadata, already_stored_in_typemap } = match *t.data() {
ty::Never | ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) => {
MetadataCreationResult::new(basic_type_metadata(cx, t), false)
}
@@ -876,7 +876,7 @@ fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
// .natvis visualizers (and perhaps other existing native debuggers?)
let msvc_like_names = cx.tcx.sess.target.target.options.is_like_msvc;

let (name, encoding) = match t.kind() {
let (name, encoding) = match t.data() {
ty::Never => ("!", DW_ATE_unsigned),
ty::Tuple(ref elements) if elements.is_empty() => ("()", DW_ATE_unsigned),
ty::Bool => ("bool", DW_ATE_boolean),
@@ -904,7 +904,7 @@ fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
return ty_metadata;
}

let typedef_name = match t.kind() {
let typedef_name = match t.data() {
ty::Int(int_ty) => int_ty.name_str(),
ty::Uint(uint_ty) => uint_ty.name_str(),
ty::Float(float_ty) => float_ty.name_str(),
@@ -1239,7 +1239,7 @@ fn prepare_struct_metadata(
) -> RecursiveTypeDescription<'ll, 'tcx> {
let struct_name = compute_debuginfo_type_name(cx.tcx, struct_type, false);

let (struct_def_id, variant) = match struct_type.kind() {
let (struct_def_id, variant) = match struct_type.data() {
ty::Adt(def, _) => (def.did, def.non_enum_variant()),
_ => bug!("prepare_struct_metadata on a non-ADT"),
};
@@ -1373,7 +1373,7 @@ fn prepare_union_metadata(
) -> RecursiveTypeDescription<'ll, 'tcx> {
let union_name = compute_debuginfo_type_name(cx.tcx, union_type, false);

let (union_def_id, variant) = match union_type.kind() {
let (union_def_id, variant) = match union_type.data() {
ty::Adt(def, _) => (def.did, def.non_enum_variant()),
_ => bug!("prepare_union_metadata on a non-ADT"),
};
@@ -1457,14 +1457,14 @@ struct EnumMemberDescriptionFactory<'ll, 'tcx> {

impl EnumMemberDescriptionFactory<'ll, 'tcx> {
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDescription<'ll>> {
let generator_variant_info_data = match *self.enum_type.kind() {
let generator_variant_info_data = match *self.enum_type.data() {
ty::Generator(def_id, ..) => {
Some(generator_layout_and_saved_local_names(cx.tcx, def_id))
}
_ => None,
};

let variant_info_for = |index: VariantIdx| match *self.enum_type.kind() {
let variant_info_for = |index: VariantIdx| match *self.enum_type.data() {
ty::Adt(adt, _) => VariantInfo::Adt(&adt.variants[index]),
ty::Generator(def_id, _, _) => {
let (generator_layout, generator_saved_local_names) =
@@ -1486,14 +1486,14 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
} else {
type_metadata(cx, self.enum_type, self.span)
};
let flags = match self.enum_type.kind() {
let flags = match self.enum_type.data() {
ty::Generator(..) => DIFlags::FlagArtificial,
_ => DIFlags::FlagZero,
};

match self.layout.variants {
Variants::Single { index } => {
if let ty::Adt(adt, _) = self.enum_type.kind() {
if let ty::Adt(adt, _) = self.enum_type.data() {
if adt.variants.is_empty() {
return vec![];
}
@@ -1941,7 +1941,7 @@ fn prepare_enum_metadata(
let tcx = cx.tcx;
let enum_name = compute_debuginfo_type_name(tcx, enum_type, false);
// FIXME(tmandry): This doesn't seem to have any effect.
let enum_flags = match enum_type.kind() {
let enum_flags = match enum_type.data() {
ty::Generator(..) => DIFlags::FlagArtificial,
_ => DIFlags::FlagZero,
};
@@ -1956,13 +1956,13 @@ fn prepare_enum_metadata(
let file_metadata = unknown_file_metadata(cx);

let discriminant_type_metadata = |discr: Primitive| {
let enumerators_metadata: Vec<_> = match enum_type.kind() {
let enumerators_metadata: Vec<_> = match enum_type.data() {
ty::Adt(def, _) => def
.discriminants(tcx)
.zip(&def.variants)
.map(|((_, discr), v)| {
let name = v.ident.as_str();
let is_unsigned = match discr.ty.kind() {
let is_unsigned = match discr.ty.data() {
ty::Int(_) => false,
ty::Uint(_) => true,
_ => bug!("non integer discriminant"),
@@ -2011,7 +2011,7 @@ fn prepare_enum_metadata(
type_metadata(cx, discr.to_ty(tcx), rustc_span::DUMMY_SP);

let item_name;
let discriminant_name = match enum_type.kind() {
let discriminant_name = match enum_type.data() {
ty::Adt(..) => {
item_name = tcx.item_name(enum_def_id).as_str();
&*item_name
@@ -2104,7 +2104,7 @@ fn prepare_enum_metadata(
);
}

let discriminator_name = match enum_type.kind() {
let discriminator_name = match enum_type.data() {
ty::Generator(..) => "__state",
_ => "",
};
@@ -2327,7 +2327,7 @@ fn set_members_of_composite_type(

/// Computes the type parameters for a type, if any, for the given metadata.
fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> Option<&'ll DIArray> {
if let ty::Adt(def, substs) = *ty.kind() {
if let ty::Adt(def, substs) = *ty.data() {
if substs.types().next().is_some() {
let generics = cx.tcx.generics_of(def.did);
let names = get_parameter_names(cx, generics);
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
@@ -361,7 +361,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
// already inaccurate due to ABI adjustments (see #42800).
signature.extend(fn_abi.args.iter().map(|arg| {
let t = arg.layout.ty;
let t = match t.kind() {
let t = match t.data() {
ty::Array(ct, _)
if (*ct == cx.tcx.types.u8) || cx.layout_of(ct).is_zst() =>
{
@@ -467,7 +467,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {

// Only "class" methods are generally understood by LLVM,
// so avoid methods on other types (e.g., `<*mut T>::null`).
match impl_self_ty.kind() {
match impl_self_ty.data() {
ty::Adt(def, ..) if !def.is_box() => {
// Again, only create type information if full debuginfo is enabled
if cx.sess().opts.debuginfo == DebugInfo::Full
Loading