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.
This commit is contained in:
parent
e57ac764b8
commit
e3755c1d54
5 changed files with 17 additions and 12 deletions
|
@ -108,7 +108,7 @@ pub struct Block {
|
||||||
type UserTy<'tcx> = Option<Box<CanonicalUserType<'tcx>>>;
|
type UserTy<'tcx> = Option<Box<CanonicalUserType<'tcx>>>;
|
||||||
|
|
||||||
#[derive(Clone, Debug, HashStable)]
|
#[derive(Clone, Debug, HashStable)]
|
||||||
pub struct Adt<'tcx> {
|
pub struct AdtExpr<'tcx> {
|
||||||
/// The ADT we're constructing.
|
/// The ADT we're constructing.
|
||||||
pub adt_def: AdtDef<'tcx>,
|
pub adt_def: AdtDef<'tcx>,
|
||||||
/// The variant of the ADT.
|
/// The variant of the ADT.
|
||||||
|
@ -390,7 +390,7 @@ pub enum ExprKind<'tcx> {
|
||||||
fields: Box<[ExprId]>,
|
fields: Box<[ExprId]>,
|
||||||
},
|
},
|
||||||
/// An ADT constructor, e.g. `Foo {x: 1, y: 2}`.
|
/// An ADT constructor, e.g. `Foo {x: 1, y: 2}`.
|
||||||
Adt(Box<Adt<'tcx>>),
|
Adt(Box<AdtExpr<'tcx>>),
|
||||||
/// A type ascription on a place.
|
/// A type ascription on a place.
|
||||||
PlaceTypeAscription {
|
PlaceTypeAscription {
|
||||||
source: ExprId,
|
source: ExprId,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use super::{
|
use super::{
|
||||||
Arm, Block, ClosureExpr, Expr, ExprKind, Guard, InlineAsmExpr, InlineAsmOperand, Pat, PatKind, Stmt, StmtKind,
|
AdtExpr, Arm, Block, ClosureExpr, Expr, ExprKind, Guard, InlineAsmExpr, InlineAsmOperand, Pat,
|
||||||
Thir,
|
PatKind, Stmt, StmtKind, Thir,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait Visitor<'a, 'tcx: 'a>: Sized {
|
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]);
|
visitor.visit_expr(&visitor.thir()[field]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Adt(box crate::thir::Adt {
|
Adt(box AdtExpr {
|
||||||
ref fields,
|
ref fields,
|
||||||
ref base,
|
ref base,
|
||||||
adt_def: _,
|
adt_def: _,
|
||||||
|
|
|
@ -314,7 +314,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
this.cfg.push_assign(block, source_info, destination, address_of);
|
this.cfg.push_assign(block, source_info, destination, address_of);
|
||||||
block.unit()
|
block.unit()
|
||||||
}
|
}
|
||||||
ExprKind::Adt(box Adt {
|
ExprKind::Adt(box AdtExpr {
|
||||||
adt_def,
|
adt_def,
|
||||||
variant_index,
|
variant_index,
|
||||||
substs,
|
substs,
|
||||||
|
@ -400,7 +400,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
);
|
);
|
||||||
block.unit()
|
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};
|
use rustc_middle::{mir, thir};
|
||||||
let operands = operands
|
let operands = operands
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
|
@ -391,7 +391,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
||||||
ExprKind::InlineAsm { .. } => {
|
ExprKind::InlineAsm { .. } => {
|
||||||
self.requires_unsafe(expr.span, UseOfInlineAssembly);
|
self.requires_unsafe(expr.span, UseOfInlineAssembly);
|
||||||
}
|
}
|
||||||
ExprKind::Adt(box Adt {
|
ExprKind::Adt(box AdtExpr {
|
||||||
adt_def,
|
adt_def,
|
||||||
variant_index: _,
|
variant_index: _,
|
||||||
substs: _,
|
substs: _,
|
||||||
|
|
|
@ -341,7 +341,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
expr: self.mirror_expr(e),
|
expr: self.mirror_expr(e),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
ExprKind::Adt(Box::new(Adt {
|
ExprKind::Adt(Box::new(AdtExpr {
|
||||||
adt_def,
|
adt_def,
|
||||||
substs,
|
substs,
|
||||||
variant_index: index,
|
variant_index: index,
|
||||||
|
@ -466,7 +466,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
let user_provided_types = self.typeck_results().user_provided_types();
|
let user_provided_types = self.typeck_results().user_provided_types();
|
||||||
let user_ty = user_provided_types.get(expr.hir_id).copied().map(Box::new);
|
let user_ty = user_provided_types.get(expr.hir_id).copied().map(Box::new);
|
||||||
debug!("make_mirror_unadjusted: (struct/union) user_ty={:?}", user_ty);
|
debug!("make_mirror_unadjusted: (struct/union) user_ty={:?}", user_ty);
|
||||||
ExprKind::Adt(Box::new(Adt {
|
ExprKind::Adt(Box::new(AdtExpr {
|
||||||
adt_def: *adt,
|
adt_def: *adt,
|
||||||
variant_index: VariantIdx::new(0),
|
variant_index: VariantIdx::new(0),
|
||||||
substs,
|
substs,
|
||||||
|
@ -493,7 +493,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
let user_ty =
|
let user_ty =
|
||||||
user_provided_types.get(expr.hir_id).copied().map(Box::new);
|
user_provided_types.get(expr.hir_id).copied().map(Box::new);
|
||||||
debug!("make_mirror_unadjusted: (variant) user_ty={:?}", user_ty);
|
debug!("make_mirror_unadjusted: (variant) user_ty={:?}", user_ty);
|
||||||
ExprKind::Adt(Box::new(Adt {
|
ExprKind::Adt(Box::new(AdtExpr {
|
||||||
adt_def: *adt,
|
adt_def: *adt,
|
||||||
variant_index: index,
|
variant_index: index,
|
||||||
substs,
|
substs,
|
||||||
|
@ -867,7 +867,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
match ty.kind() {
|
match ty.kind() {
|
||||||
// A unit struct/variant which is used as a value.
|
// A unit struct/variant which is used as a value.
|
||||||
// We return a completely different ExprKind here to account for this special case.
|
// 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,
|
adt_def: *adt_def,
|
||||||
variant_index: adt_def.variant_index_with_ctor_id(def_id),
|
variant_index: adt_def.variant_index_with_ctor_id(def_id),
|
||||||
substs,
|
substs,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue