Remove `Clone` impl for `thir::Expr`

This commit is contained in:
LeSeulArtichaut 2021-03-03 18:07:57 +01:00
parent 2a2b4d7257
commit a9f4dfc8fa
2 changed files with 13 additions and 14 deletions

View File

@ -21,7 +21,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let source_info = this.source_info(expr.span);
// Handle a number of expressions that don't need a destination at all. This
// avoids needing a mountain of temporary `()` variables.
let expr2 = expr.clone();
match &expr.kind {
ExprKind::Scope { region_scope, lint_level, value } => {
this.in_scope((*region_scope, source_info), *lint_level, |this| {
@ -35,7 +34,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// is better for borrowck interaction with overloaded
// operators like x[j] = x[i].
debug!("stmt_expr Assign block_context.push(SubExpr) : {:?}", expr2);
debug!("stmt_expr Assign block_context.push(SubExpr) : {:?}", expr);
this.block_context.push(BlockFrame::SubExpr);
// Generate better code for things that don't need to be
@ -64,7 +63,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let lhs_ty = lhs.ty;
debug!("stmt_expr AssignOp block_context.push(SubExpr) : {:?}", expr2);
debug!("stmt_expr AssignOp block_context.push(SubExpr) : {:?}", expr);
this.block_context.push(BlockFrame::SubExpr);
// As above, RTL.
@ -102,7 +101,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
this.break_scope(block, value.as_deref(), BreakableTarget::Return, source_info)
}
ExprKind::LlvmInlineAsm { asm, outputs, inputs } => {
debug!("stmt_expr LlvmInlineAsm block_context.push(SubExpr) : {:?}", expr2);
debug!("stmt_expr LlvmInlineAsm block_context.push(SubExpr) : {:?}", expr);
this.block_context.push(BlockFrame::SubExpr);
let outputs = outputs
.into_iter()

View File

@ -32,7 +32,7 @@ crate enum LintLevel {
Explicit(hir::HirId),
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate struct Block<'tcx> {
crate targeted_by_break: bool,
crate region_scope: region::Scope,
@ -51,13 +51,13 @@ crate enum BlockSafety {
PopUnsafe,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate struct Stmt<'tcx> {
crate kind: StmtKind<'tcx>,
crate opt_destruction_scope: Option<region::Scope>,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate enum StmtKind<'tcx> {
Expr {
/// scope for this statement; may be used as lifetime of temporaries
@ -107,7 +107,7 @@ rustc_data_structures::static_assert_size!(Expr<'_>, 160);
/// MIR simplifications are already done in the impl of `Thir`. For
/// example, method calls and overloaded operators are absent: they are
/// expected to be converted into `Expr::Call` instances.
#[derive(Clone, Debug)]
#[derive(Debug)]
crate struct Expr<'tcx> {
/// type of this expression
crate ty: Ty<'tcx>,
@ -123,7 +123,7 @@ crate struct Expr<'tcx> {
crate kind: ExprKind<'tcx>,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate enum ExprKind<'tcx> {
Scope {
region_scope: region::Scope,
@ -312,19 +312,19 @@ crate enum ExprKind<'tcx> {
},
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate struct FieldExpr<'tcx> {
crate name: Field,
crate expr: Expr<'tcx>,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate struct FruInfo<'tcx> {
crate base: Box<Expr<'tcx>>,
crate field_types: Vec<Ty<'tcx>>,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate struct Arm<'tcx> {
crate pattern: Pat<'tcx>,
crate guard: Option<Guard<'tcx>>,
@ -334,7 +334,7 @@ crate struct Arm<'tcx> {
crate span: Span,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate enum Guard<'tcx> {
If(Box<Expr<'tcx>>),
IfLet(Pat<'tcx>, Box<Expr<'tcx>>),
@ -346,7 +346,7 @@ crate enum LogicalOp {
Or,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
crate enum InlineAsmOperand<'tcx> {
In {
reg: InlineAsmRegOrRegClass,