about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/builder.rs4
-rw-r--r--compiler/rustc_codegen_llvm/src/consts.rs2
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs38
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/mod.rs6
-rw-r--r--compiler/rustc_codegen_llvm/src/intrinsic.rs52
-rw-r--r--compiler/rustc_codegen_llvm/src/type_of.rs10
6 files changed, 56 insertions, 56 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs
index 89c3e21632e..23a3be1a2f2 100644
--- a/compiler/rustc_codegen_llvm/src/builder.rs
+++ b/compiler/rustc_codegen_llvm/src/builder.rs
@@ -306,10 +306,10 @@ 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.kind() {
             Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.ptr_width)),
             Uint(t @ Usize) => Uint(t.normalize(self.tcx.sess.target.ptr_width)),
-            ref t @ (Uint(_) | Int(_)) => t.clone(),
+            t @ (Uint(_) | Int(_)) => t.clone(),
             _ => panic!("tried to get overflow intrinsic for op applied to non-int type"),
         };
 
diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs
index 86a5ec59254..2b2bcd97999 100644
--- a/compiler/rustc_codegen_llvm/src/consts.rs
+++ b/compiler/rustc_codegen_llvm/src/consts.rs
@@ -125,7 +125,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.kind() {
             cx.layout_of(mt.ty).llvm_type(cx)
         } else {
             cx.sess().span_fatal(
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index 9d92d53775c..868eb74cf09 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -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.kind() {
         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().kind() {
             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.kind() {
         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.kind() {
         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.kind() {
         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.kind() {
         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.kind() {
         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.kind() {
         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.kind() {
         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.kind() {
             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.kind() {
             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.kind() {
             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.kind() {
                     if adt.variants.is_empty() {
                         return vec![];
                     }
@@ -1942,7 +1942,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.kind() {
         ty::Generator(..) => DIFlags::FlagArtificial,
         _ => DIFlags::FlagZero,
     };
@@ -1957,13 +1957,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.kind() {
             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.kind() {
                         ty::Int(_) => false,
                         ty::Uint(_) => true,
                         _ => bug!("non integer discriminant"),
@@ -2012,7 +2012,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.kind() {
                     ty::Adt(..) => {
                         item_name = tcx.item_name(enum_def_id).as_str();
                         &*item_name
@@ -2105,7 +2105,7 @@ fn prepare_enum_metadata(
         );
     }
 
-    let discriminator_name = match &enum_type.kind {
+    let discriminator_name = match enum_type.kind() {
         ty::Generator(..) => "__state",
         _ => "",
     };
@@ -2328,7 +2328,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.kind() {
         if substs.types().next().is_some() {
             let generics = cx.tcx.generics_of(def.did);
             let names = get_parameter_names(cx, generics);
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
index b414426af8c..7cdd366175d 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
@@ -361,9 +361,9 @@ 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.kind() {
                         ty::Array(ct, _)
-                            if (ct == cx.tcx.types.u8) || cx.layout_of(ct).is_zst() =>
+                            if (*ct == cx.tcx.types.u8) || cx.layout_of(ct).is_zst() =>
                         {
                             cx.tcx.mk_imm_ptr(ct)
                         }
@@ -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.kind() {
                         ty::Adt(def, ..) if !def.is_box() => {
                             // Again, only create type information if full debuginfo is enabled
                             if cx.sess().opts.debuginfo == DebugInfo::Full
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs
index 951b9928cc9..2208ceca00c 100644
--- a/compiler/rustc_codegen_llvm/src/intrinsic.rs
+++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs
@@ -90,7 +90,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
         let tcx = self.tcx;
         let callee_ty = instance.ty(tcx, ty::ParamEnv::reveal_all());
 
-        let (def_id, substs) = match callee_ty.kind {
+        let (def_id, substs) = match *callee_ty.kind() {
             ty::FnDef(def_id, substs) => (def_id, substs),
             _ => bug!("expected fn item type, found {}", callee_ty),
         };
@@ -1271,7 +1271,7 @@ fn generic_simd_intrinsic(
 
     if name == sym::simd_select_bitmask {
         let in_ty = arg_tys[0];
-        let m_len = match in_ty.kind {
+        let m_len = match in_ty.kind() {
             // Note that this `.unwrap()` crashes for isize/usize, that's sort
             // of intentional as there's not currently a use case for that.
             ty::Int(i) => i.bit_width().unwrap(),
@@ -1436,7 +1436,7 @@ fn generic_simd_intrinsic(
             m_len,
             v_len
         );
-        match m_elem_ty.kind {
+        match m_elem_ty.kind() {
             ty::Int(_) => {}
             _ => return_error!("mask element type is `{}`, expected `i_`", m_elem_ty),
         }
@@ -1455,13 +1455,13 @@ fn generic_simd_intrinsic(
         // If the vector has less than 8 lanes, an u8 is returned with zeroed
         // trailing bits.
         let expected_int_bits = in_len.max(8);
-        match ret_ty.kind {
+        match ret_ty.kind() {
             ty::Uint(i) if i.bit_width() == Some(expected_int_bits) => (),
             _ => return_error!("bitmask `{}`, expected `u{}`", ret_ty, expected_int_bits),
         }
 
         // Integer vector <i{in_bitwidth} x in_len>:
-        let (i_xn, in_elem_bitwidth) = match in_elem.kind {
+        let (i_xn, in_elem_bitwidth) = match in_elem.kind() {
             ty::Int(i) => {
                 (args[0].immediate(), i.bit_width().unwrap_or(bx.data_layout().pointer_size.bits()))
             }
@@ -1518,7 +1518,7 @@ fn generic_simd_intrinsic(
                 }
             }
         }
-        let ety = match in_elem.kind {
+        let ety = match in_elem.kind() {
             ty::Float(f) if f.bit_width() == 32 => {
                 if in_len < 2 || in_len > 16 {
                     return_error!(
@@ -1612,7 +1612,7 @@ fn generic_simd_intrinsic(
     //  https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Intrinsics.h#L81
     fn llvm_vector_str(elem_ty: Ty<'_>, vec_len: u64, no_pointers: usize) -> String {
         let p0s: String = "p0".repeat(no_pointers);
-        match elem_ty.kind {
+        match *elem_ty.kind() {
             ty::Int(v) => format!("v{}{}i{}", vec_len, p0s, v.bit_width().unwrap()),
             ty::Uint(v) => format!("v{}{}i{}", vec_len, p0s, v.bit_width().unwrap()),
             ty::Float(v) => format!("v{}{}f{}", vec_len, p0s, v.bit_width()),
@@ -1627,7 +1627,7 @@ fn generic_simd_intrinsic(
         mut no_pointers: usize,
     ) -> &'ll Type {
         // FIXME: use cx.layout_of(ty).llvm_type() ?
-        let mut elem_ty = match elem_ty.kind {
+        let mut elem_ty = match *elem_ty.kind() {
             ty::Int(v) => cx.type_int_from_ty(v),
             ty::Uint(v) => cx.type_uint_from_ty(v),
             ty::Float(v) => cx.type_float_from_ty(v),
@@ -1680,7 +1680,7 @@ fn generic_simd_intrinsic(
 
         // This counts how many pointers
         fn ptr_count(t: Ty<'_>) -> usize {
-            match t.kind {
+            match t.kind() {
                 ty::RawPtr(p) => 1 + ptr_count(p.ty),
                 _ => 0,
             }
@@ -1688,7 +1688,7 @@ fn generic_simd_intrinsic(
 
         // Non-ptr type
         fn non_ptr(t: Ty<'_>) -> Ty<'_> {
-            match t.kind {
+            match t.kind() {
                 ty::RawPtr(p) => non_ptr(p.ty),
                 _ => t,
             }
@@ -1696,7 +1696,7 @@ fn generic_simd_intrinsic(
 
         // The second argument must be a simd vector with an element type that's a pointer
         // to the element type of the first argument
-        let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).kind {
+        let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).kind() {
             ty::RawPtr(p) if p.ty == in_elem => {
                 (ptr_count(arg_tys[1].simd_type(tcx)), non_ptr(arg_tys[1].simd_type(tcx)))
             }
@@ -1721,7 +1721,7 @@ fn generic_simd_intrinsic(
         assert_eq!(underlying_ty, non_ptr(arg_tys[0].simd_type(tcx)));
 
         // The element type of the third argument must be a signed integer type of any width:
-        match arg_tys[2].simd_type(tcx).kind {
+        match arg_tys[2].simd_type(tcx).kind() {
             ty::Int(_) => (),
             _ => {
                 require!(
@@ -1803,7 +1803,7 @@ fn generic_simd_intrinsic(
 
         // This counts how many pointers
         fn ptr_count(t: Ty<'_>) -> usize {
-            match t.kind {
+            match t.kind() {
                 ty::RawPtr(p) => 1 + ptr_count(p.ty),
                 _ => 0,
             }
@@ -1811,7 +1811,7 @@ fn generic_simd_intrinsic(
 
         // Non-ptr type
         fn non_ptr(t: Ty<'_>) -> Ty<'_> {
-            match t.kind {
+            match t.kind() {
                 ty::RawPtr(p) => non_ptr(p.ty),
                 _ => t,
             }
@@ -1819,7 +1819,7 @@ fn generic_simd_intrinsic(
 
         // The second argument must be a simd vector with an element type that's a pointer
         // to the element type of the first argument
-        let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).kind {
+        let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).kind() {
             ty::RawPtr(p) if p.ty == in_elem && p.mutbl == hir::Mutability::Mut => {
                 (ptr_count(arg_tys[1].simd_type(tcx)), non_ptr(arg_tys[1].simd_type(tcx)))
             }
@@ -1844,7 +1844,7 @@ fn generic_simd_intrinsic(
         assert_eq!(underlying_ty, non_ptr(arg_tys[0].simd_type(tcx)));
 
         // The element type of the third argument must be a signed integer type of any width:
-        match arg_tys[2].simd_type(tcx).kind {
+        match arg_tys[2].simd_type(tcx).kind() {
             ty::Int(_) => (),
             _ => {
                 require!(
@@ -1900,7 +1900,7 @@ fn generic_simd_intrinsic(
                     in_ty,
                     ret_ty
                 );
-                return match in_elem.kind {
+                return match in_elem.kind() {
                     ty::Int(_) | ty::Uint(_) => {
                         let r = bx.$integer_reduce(args[0].immediate());
                         if $ordered {
@@ -1972,7 +1972,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
                     in_ty,
                     ret_ty
                 );
-                return match in_elem.kind {
+                return match in_elem.kind() {
                     ty::Int(_i) => Ok(bx.$int_red(args[0].immediate(), true)),
                     ty::Uint(_u) => Ok(bx.$int_red(args[0].immediate(), false)),
                     ty::Float(_f) => Ok(bx.$float_red(args[0].immediate())),
@@ -2007,7 +2007,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
                     );
                     args[0].immediate()
                 } else {
-                    match in_elem.kind {
+                    match in_elem.kind() {
                         ty::Int(_) | ty::Uint(_) => {}
                         _ => return_error!(
                             "unsupported {} from `{}` with element `{}` to `{}`",
@@ -2023,7 +2023,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
                     let i1xn = bx.type_vector(i1, in_len as u64);
                     bx.trunc(args[0].immediate(), i1xn)
                 };
-                return match in_elem.kind {
+                return match in_elem.kind() {
                     ty::Int(_) | ty::Uint(_) => {
                         let r = bx.$red(input);
                         Ok(if !$boolean { r } else { bx.zext(r, bx.type_bool()) })
@@ -2071,7 +2071,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
             Unsupported,
         }
 
-        let (in_style, in_width) = match in_elem.kind {
+        let (in_style, in_width) = match in_elem.kind() {
             // vectors of pointer-sized integers should've been
             // disallowed before here, so this unwrap is safe.
             ty::Int(i) => (Style::Int(true), i.bit_width().unwrap()),
@@ -2079,7 +2079,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
             ty::Float(f) => (Style::Float, f.bit_width()),
             _ => (Style::Unsupported, 0),
         };
-        let (out_style, out_width) = match out_elem.kind {
+        let (out_style, out_width) = match out_elem.kind() {
             ty::Int(i) => (Style::Int(true), i.bit_width().unwrap()),
             ty::Uint(u) => (Style::Int(false), u.bit_width().unwrap()),
             ty::Float(f) => (Style::Float, f.bit_width()),
@@ -2135,7 +2135,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
     macro_rules! arith {
         ($($name: ident: $($($p: ident),* => $call: ident),*;)*) => {
             $(if name == sym::$name {
-                match in_elem.kind {
+                match in_elem.kind() {
                     $($(ty::$p(_))|* => {
                         return Ok(bx.$call(args[0].immediate(), args[1].immediate()))
                     })*
@@ -2169,7 +2169,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
         let rhs = args[1].immediate();
         let is_add = name == sym::simd_saturating_add;
         let ptr_bits = bx.tcx().data_layout.pointer_size.bits() as _;
-        let (signed, elem_width, elem_ty) = match in_elem.kind {
+        let (signed, elem_width, elem_ty) = match *in_elem.kind() {
             ty::Int(i) => (true, i.bit_width().unwrap_or(ptr_bits), bx.cx.type_int_from_ty(i)),
             ty::Uint(i) => (false, i.bit_width().unwrap_or(ptr_bits), bx.cx.type_uint_from_ty(i)),
             _ => {
@@ -2204,7 +2204,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
 // FIXME: there’s multiple of this functions, investigate using some of the already existing
 // stuffs.
 fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, bool)> {
-    match ty.kind {
+    match ty.kind() {
         ty::Int(t) => Some((
             match t {
                 ast::IntTy::Isize => u64::from(cx.tcx.sess.target.ptr_width),
@@ -2234,7 +2234,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
 // Returns the width of a float Ty
 // Returns None if the type is not a float
 fn float_type_width(ty: Ty<'_>) -> Option<u64> {
-    match ty.kind {
+    match ty.kind() {
         ty::Float(t) => Some(t.bit_width()),
         _ => None,
     }
diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs
index 5df78e253d4..12901de6048 100644
--- a/compiler/rustc_codegen_llvm/src/type_of.rs
+++ b/compiler/rustc_codegen_llvm/src/type_of.rs
@@ -51,7 +51,7 @@ fn uncached_llvm_type<'a, 'tcx>(
         Abi::Uninhabited | Abi::Aggregate { .. } => {}
     }
 
-    let name = match layout.ty.kind {
+    let name = match layout.ty.kind() {
         // FIXME(eddyb) producing readable type names for trait objects can result
         // in problematically distinct types due to HRTB and subtyping (see #47638).
         // ty::Dynamic(..) |
@@ -60,14 +60,14 @@ fn uncached_llvm_type<'a, 'tcx>(
         {
             let mut name = with_no_trimmed_paths(|| layout.ty.to_string());
             if let (&ty::Adt(def, _), &Variants::Single { index }) =
-                (&layout.ty.kind, &layout.variants)
+                (layout.ty.kind(), &layout.variants)
             {
                 if def.is_enum() && !def.variants.is_empty() {
                     write!(&mut name, "::{}", def.variants[index].ident).unwrap();
                 }
             }
             if let (&ty::Generator(_, _, _), &Variants::Single { index }) =
-                (&layout.ty.kind, &layout.variants)
+                (layout.ty.kind(), &layout.variants)
             {
                 write!(&mut name, "::{}", ty::GeneratorSubsts::variant_name(index)).unwrap();
             }
@@ -238,7 +238,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
             if let Some(&llty) = cx.scalar_lltypes.borrow().get(&self.ty) {
                 return llty;
             }
-            let llty = match self.ty.kind {
+            let llty = match *self.ty.kind() {
                 ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => {
                     cx.type_ptr_to(cx.layout_of(ty).llvm_type(cx))
                 }
@@ -331,7 +331,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
     ) -> &'a Type {
         // HACK(eddyb) special-case fat pointers until LLVM removes
         // pointee types, to avoid bitcasting every `OperandRef::deref`.
-        match self.ty.kind {
+        match self.ty.kind() {
             ty::Ref(..) | ty::RawPtr(_) => {
                 return self.field(cx, index).llvm_type(cx);
             }