Skip to content

Commit

Permalink
Remove Clone impl for thir::Expr
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSeulArtichaut committed Mar 9, 2021
1 parent 2a2b4d7 commit a9f4dfc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions compiler/rustc_mir_build/src/build/expr/stmt.rs
Expand Up @@ -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| {
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand Down
20 changes: 10 additions & 10 deletions compiler/rustc_mir_build/src/thir/mod.rs
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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>,
Expand All @@ -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,
Expand Down Expand Up @@ -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>>,
Expand All @@ -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>>),
Expand All @@ -346,7 +346,7 @@ crate enum LogicalOp {
Or,
}

#[derive(Clone, Debug)]
#[derive(Debug)]
crate enum InlineAsmOperand<'tcx> {
In {
reg: InlineAsmRegOrRegClass,
Expand Down

0 comments on commit a9f4dfc

Please sign in to comment.