about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorLeSeulArtichaut <leseulartichaut@gmail.com>2021-06-13 15:39:57 +0200
committerLeSeulArtichaut <leseulartichaut@gmail.com>2021-06-13 17:03:11 +0200
commit5e802e5e97c1c5b995bb68edc2d40557b8af83fc (patch)
tree90a4ff774aecef178a5fc70ebe3744b1cbb37d89 /compiler/rustc_middle
parent6cc5d5432aaed21630ead1fa59418245ee2e1047 (diff)
downloadrust-5e802e5e97c1c5b995bb68edc2d40557b8af83fc.tar.gz
rust-5e802e5e97c1c5b995bb68edc2d40557b8af83fc.zip
Box `ExprKind::Adt`
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/thir.rs29
1 files changed, 16 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs
index a5069113702..436cd305a7f 100644
--- a/compiler/rustc_middle/src/thir.rs
+++ b/compiler/rustc_middle/src/thir.rs
@@ -97,6 +97,20 @@ pub struct Block {
     pub safety_mode: BlockSafety,
 }
 
+#[derive(Debug, HashStable)]
+pub struct Adt<'tcx> {
+    pub adt_def: &'tcx AdtDef,
+    pub variant_index: VariantIdx,
+    pub substs: SubstsRef<'tcx>,
+
+    /// Optional user-given substs: for something like `let x =
+    /// Bar::<T> { ... }`.
+    pub user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
+
+    pub fields: Box<[FieldExpr]>,
+    pub base: Option<FruInfo<'tcx>>,
+}
+
 #[derive(Copy, Clone, Debug, HashStable)]
 pub enum BlockSafety {
     Safe,
@@ -145,7 +159,7 @@ pub enum StmtKind<'tcx> {
 
 // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-rustc_data_structures::static_assert_size!(Expr<'_>, 144);
+rustc_data_structures::static_assert_size!(Expr<'_>, 104);
 
 /// The Thir trait implementor lowers their expressions (`&'tcx H::Expr`)
 /// into instances of this `Expr` enum. This lowering can be done
@@ -304,18 +318,7 @@ pub enum ExprKind<'tcx> {
     Tuple {
         fields: Box<[ExprId]>,
     },
-    Adt {
-        adt_def: &'tcx AdtDef,
-        variant_index: VariantIdx,
-        substs: SubstsRef<'tcx>,
-
-        /// Optional user-given substs: for something like `let x =
-        /// Bar::<T> { ... }`.
-        user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
-
-        fields: Box<[FieldExpr]>,
-        base: Option<FruInfo<'tcx>>,
-    },
+    Adt(Box<Adt<'tcx>>),
     PlaceTypeAscription {
         source: ExprId,
         /// Type that the user gave to this expression