]> git.lizzy.rs Git - rust.git/commitdiff
Rename `thir::Adt` as `thir::AdtExpr`.
authorNicholas Nethercote <n.nethercote@gmail.com>
Wed, 24 Aug 2022 02:59:06 +0000 (12:59 +1000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Wed, 24 Aug 2022 05:06:50 +0000 (15:06 +1000)
This matches the naming scheme used elsewhere, e.g. in the AST, and
avoids name clashes with the `ExprKind::Closure` variant.

compiler/rustc_middle/src/thir.rs
compiler/rustc_middle/src/thir/visit.rs
compiler/rustc_mir_build/src/build/expr/into.rs
compiler/rustc_mir_build/src/check_unsafety.rs
compiler/rustc_mir_build/src/thir/cx/expr.rs

index 17dadecfae0b4184e504072ed469c540ec3916a1..c5d0892dde910c0f24dfea0978db45586181610e 100644 (file)
@@ -108,7 +108,7 @@ pub struct Block {
 type UserTy<'tcx> = Option<Box<CanonicalUserType<'tcx>>>;
 
 #[derive(Clone, Debug, HashStable)]
-pub struct Adt<'tcx> {
+pub struct AdtExpr<'tcx> {
     /// The ADT we're constructing.
     pub adt_def: AdtDef<'tcx>,
     /// The variant of the ADT.
@@ -390,7 +390,7 @@ pub enum ExprKind<'tcx> {
         fields: Box<[ExprId]>,
     },
     /// An ADT constructor, e.g. `Foo {x: 1, y: 2}`.
-    Adt(Box<Adt<'tcx>>),
+    Adt(Box<AdtExpr<'tcx>>),
     /// A type ascription on a place.
     PlaceTypeAscription {
         source: ExprId,
index 68100f037d9362b9264610b091718d9316e5ed64..c5c48a6360925a151a3c50ca3ef457059c6bad8e 100644 (file)
@@ -1,6 +1,6 @@
 use super::{
-    Arm, Block, ClosureExpr, Expr, ExprKind, Guard, InlineAsmExpr, InlineAsmOperand, Pat, PatKind, Stmt, StmtKind,
-    Thir,
+    AdtExpr, Arm, Block, ClosureExpr, Expr, ExprKind, Guard, InlineAsmExpr, InlineAsmOperand, Pat,
+    PatKind, Stmt, StmtKind, Thir,
 };
 
 pub trait Visitor<'a, 'tcx: 'a>: Sized {
@@ -109,7 +109,7 @@ pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Exp
                 visitor.visit_expr(&visitor.thir()[field]);
             }
         }
-        Adt(box crate::thir::Adt {
+        Adt(box AdtExpr {
             ref fields,
             ref base,
             adt_def: _,
index dd6162300c34cd566d35c1a163c717196ce68c4c..48ec7a06724a11d0c11081d2da602d590681fe4c 100644 (file)
@@ -314,7 +314,7 @@ pub(crate) fn expr_into_dest(
                 this.cfg.push_assign(block, source_info, destination, address_of);
                 block.unit()
             }
-            ExprKind::Adt(box Adt {
+            ExprKind::Adt(box AdtExpr {
                 adt_def,
                 variant_index,
                 substs,
@@ -400,7 +400,12 @@ pub(crate) fn expr_into_dest(
                 );
                 block.unit()
             }
-            ExprKind::InlineAsm(box InlineAsmExpr { template, ref operands, options, line_spans }) => {
+            ExprKind::InlineAsm(box InlineAsmExpr {
+                template,
+                ref operands,
+                options,
+                line_spans,
+            }) => {
                 use rustc_middle::{mir, thir};
                 let operands = operands
                     .into_iter()
index 6564c526c5be4dcfc5e2cada71e34f840d093691..bf5a2e7c73fabf8a36ac3e9a01bd0fc8f83cdbdb 100644 (file)
@@ -391,7 +391,7 @@ fn visit_expr(&mut self, expr: &Expr<'tcx>) {
             ExprKind::InlineAsm { .. } => {
                 self.requires_unsafe(expr.span, UseOfInlineAssembly);
             }
-            ExprKind::Adt(box Adt {
+            ExprKind::Adt(box AdtExpr {
                 adt_def,
                 variant_index: _,
                 substs: _,
index 0012de45b9e9e48fc8a28aea1d35716fe841e53e..0c2b117453fe9ed5785a444d4ee0deff4186f34b 100644 (file)
@@ -341,7 +341,7 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
                                 expr: self.mirror_expr(e),
                             })
                             .collect();
-                        ExprKind::Adt(Box::new(Adt {
+                        ExprKind::Adt(Box::new(AdtExpr {
                             adt_def,
                             substs,
                             variant_index: index,
@@ -466,7 +466,7 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
                         let user_provided_types = self.typeck_results().user_provided_types();
                         let user_ty = user_provided_types.get(expr.hir_id).copied().map(Box::new);
                         debug!("make_mirror_unadjusted: (struct/union) user_ty={:?}", user_ty);
-                        ExprKind::Adt(Box::new(Adt {
+                        ExprKind::Adt(Box::new(AdtExpr {
                             adt_def: *adt,
                             variant_index: VariantIdx::new(0),
                             substs,
@@ -493,7 +493,7 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
                                 let user_ty =
                                     user_provided_types.get(expr.hir_id).copied().map(Box::new);
                                 debug!("make_mirror_unadjusted: (variant) user_ty={:?}", user_ty);
-                                ExprKind::Adt(Box::new(Adt {
+                                ExprKind::Adt(Box::new(AdtExpr {
                                     adt_def: *adt,
                                     variant_index: index,
                                     substs,
@@ -867,7 +867,7 @@ fn convert_path_expr(&mut self, expr: &'tcx hir::Expr<'tcx>, res: Res) -> ExprKi
                 match ty.kind() {
                     // A unit struct/variant which is used as a value.
                     // We return a completely different ExprKind here to account for this special case.
-                    ty::Adt(adt_def, substs) => ExprKind::Adt(Box::new(Adt {
+                    ty::Adt(adt_def, substs) => ExprKind::Adt(Box::new(AdtExpr {
                         adt_def: *adt_def,
                         variant_index: adt_def.variant_index_with_ctor_id(def_id),
                         substs,