Skip to content

Commit e3755c1

Browse files
committed
Rename thir::Adt as thir::AdtExpr.
This matches the naming scheme used elsewhere, e.g. in the AST, and avoids name clashes with the `ExprKind::Closure` variant.
1 parent e57ac76 commit e3755c1

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

compiler/rustc_middle/src/thir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub struct Block {
108108
type UserTy<'tcx> = Option<Box<CanonicalUserType<'tcx>>>;
109109

110110
#[derive(Clone, Debug, HashStable)]
111-
pub struct Adt<'tcx> {
111+
pub struct AdtExpr<'tcx> {
112112
/// The ADT we're constructing.
113113
pub adt_def: AdtDef<'tcx>,
114114
/// The variant of the ADT.
@@ -390,7 +390,7 @@ pub enum ExprKind<'tcx> {
390390
fields: Box<[ExprId]>,
391391
},
392392
/// An ADT constructor, e.g. `Foo {x: 1, y: 2}`.
393-
Adt(Box<Adt<'tcx>>),
393+
Adt(Box<AdtExpr<'tcx>>),
394394
/// A type ascription on a place.
395395
PlaceTypeAscription {
396396
source: ExprId,

compiler/rustc_middle/src/thir/visit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::{
2-
Arm, Block, ClosureExpr, Expr, ExprKind, Guard, InlineAsmExpr, InlineAsmOperand, Pat, PatKind, Stmt, StmtKind,
3-
Thir,
2+
AdtExpr, Arm, Block, ClosureExpr, Expr, ExprKind, Guard, InlineAsmExpr, InlineAsmOperand, Pat,
3+
PatKind, Stmt, StmtKind, Thir,
44
};
55

66
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
109109
visitor.visit_expr(&visitor.thir()[field]);
110110
}
111111
}
112-
Adt(box crate::thir::Adt {
112+
Adt(box AdtExpr {
113113
ref fields,
114114
ref base,
115115
adt_def: _,

compiler/rustc_mir_build/src/build/expr/into.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
314314
this.cfg.push_assign(block, source_info, destination, address_of);
315315
block.unit()
316316
}
317-
ExprKind::Adt(box Adt {
317+
ExprKind::Adt(box AdtExpr {
318318
adt_def,
319319
variant_index,
320320
substs,
@@ -400,7 +400,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
400400
);
401401
block.unit()
402402
}
403-
ExprKind::InlineAsm(box InlineAsmExpr { template, ref operands, options, line_spans }) => {
403+
ExprKind::InlineAsm(box InlineAsmExpr {
404+
template,
405+
ref operands,
406+
options,
407+
line_spans,
408+
}) => {
404409
use rustc_middle::{mir, thir};
405410
let operands = operands
406411
.into_iter()

compiler/rustc_mir_build/src/check_unsafety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
391391
ExprKind::InlineAsm { .. } => {
392392
self.requires_unsafe(expr.span, UseOfInlineAssembly);
393393
}
394-
ExprKind::Adt(box Adt {
394+
ExprKind::Adt(box AdtExpr {
395395
adt_def,
396396
variant_index: _,
397397
substs: _,

compiler/rustc_mir_build/src/thir/cx/expr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl<'tcx> Cx<'tcx> {
341341
expr: self.mirror_expr(e),
342342
})
343343
.collect();
344-
ExprKind::Adt(Box::new(Adt {
344+
ExprKind::Adt(Box::new(AdtExpr {
345345
adt_def,
346346
substs,
347347
variant_index: index,
@@ -466,7 +466,7 @@ impl<'tcx> Cx<'tcx> {
466466
let user_provided_types = self.typeck_results().user_provided_types();
467467
let user_ty = user_provided_types.get(expr.hir_id).copied().map(Box::new);
468468
debug!("make_mirror_unadjusted: (struct/union) user_ty={:?}", user_ty);
469-
ExprKind::Adt(Box::new(Adt {
469+
ExprKind::Adt(Box::new(AdtExpr {
470470
adt_def: *adt,
471471
variant_index: VariantIdx::new(0),
472472
substs,
@@ -493,7 +493,7 @@ impl<'tcx> Cx<'tcx> {
493493
let user_ty =
494494
user_provided_types.get(expr.hir_id).copied().map(Box::new);
495495
debug!("make_mirror_unadjusted: (variant) user_ty={:?}", user_ty);
496-
ExprKind::Adt(Box::new(Adt {
496+
ExprKind::Adt(Box::new(AdtExpr {
497497
adt_def: *adt,
498498
variant_index: index,
499499
substs,
@@ -867,7 +867,7 @@ impl<'tcx> Cx<'tcx> {
867867
match ty.kind() {
868868
// A unit struct/variant which is used as a value.
869869
// We return a completely different ExprKind here to account for this special case.
870-
ty::Adt(adt_def, substs) => ExprKind::Adt(Box::new(Adt {
870+
ty::Adt(adt_def, substs) => ExprKind::Adt(Box::new(AdtExpr {
871871
adt_def: *adt_def,
872872
variant_index: adt_def.variant_index_with_ctor_id(def_id),
873873
substs,

0 commit comments

Comments
 (0)