about summary refs log tree commit diff
path: root/compiler/rustc_transmute/src/layout/tree.rs
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2024-09-15 22:16:21 +0200
committerLukas Markeffsky <@>2024-09-16 15:53:21 +0200
commit697450151c0b674eae406a4d1e0854e9386ac7ea (patch)
treef5df62671bfc0e817080d1e4643cb880ec2d10f2 /compiler/rustc_transmute/src/layout/tree.rs
parent16be6666d4502e0e2255b9c4c1afab87db0ac50f (diff)
downloadrust-697450151c0b674eae406a4d1e0854e9386ac7ea.tar.gz
rust-697450151c0b674eae406a4d1e0854e9386ac7ea.zip
layout computation: eagerly error for unexpected unsized fields
Diffstat (limited to 'compiler/rustc_transmute/src/layout/tree.rs')
-rw-r--r--compiler/rustc_transmute/src/layout/tree.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs
index 3b7284c1ad6..ddf9b6c28f3 100644
--- a/compiler/rustc_transmute/src/layout/tree.rs
+++ b/compiler/rustc_transmute/src/layout/tree.rs
@@ -212,7 +212,7 @@ pub(crate) mod rustc {
                 return Err(Err::TypeError(e));
             }
 
-            let target = cx.tcx.data_layout();
+            let target = cx.data_layout();
             let pointer_size = target.pointer_size;
 
             match ty.kind() {
@@ -320,7 +320,7 @@ pub(crate) mod rustc {
 
             // Computes the variant of a given index.
             let layout_of_variant = |index, encoding: Option<TagEncoding<VariantIdx>>| {
-                let tag = cx.tcx.tag_for_variant((cx.tcx.erase_regions(ty), index));
+                let tag = cx.tcx().tag_for_variant((cx.tcx().erase_regions(ty), index));
                 let variant_def = Def::Variant(def.variant(index));
                 let variant_layout = ty_variant(cx, (ty, layout), index);
                 Self::from_variant(
@@ -417,7 +417,7 @@ pub(crate) mod rustc {
                         }
                     }
                 }
-                struct_tree = struct_tree.then(Self::from_tag(*tag, cx.tcx));
+                struct_tree = struct_tree.then(Self::from_tag(*tag, cx.tcx()));
             }
 
             // Append the fields, in memory order, to the layout.
@@ -509,12 +509,12 @@ pub(crate) mod rustc {
                 match layout.variants {
                     Variants::Single { index } => {
                         let field = &def.variant(index).fields[i];
-                        field.ty(cx.tcx, args)
+                        field.ty(cx.tcx(), args)
                     }
                     // Discriminant field for enums (where applicable).
                     Variants::Multiple { tag, .. } => {
                         assert_eq!(i.as_usize(), 0);
-                        ty::layout::PrimitiveExt::to_ty(&tag.primitive(), cx.tcx)
+                        ty::layout::PrimitiveExt::to_ty(&tag.primitive(), cx.tcx())
                     }
                 }
             }
@@ -531,7 +531,7 @@ pub(crate) mod rustc {
         (ty, layout): (Ty<'tcx>, Layout<'tcx>),
         i: VariantIdx,
     ) -> Layout<'tcx> {
-        let ty = cx.tcx.erase_regions(ty);
+        let ty = cx.tcx().erase_regions(ty);
         TyAndLayout { ty, layout }.for_variant(&cx, i).layout
     }
 }