Skip to content

Commit a9f4dfc

Browse files
Remove Clone impl for thir::Expr
1 parent 2a2b4d7 commit a9f4dfc

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2121
let source_info = this.source_info(expr.span);
2222
// Handle a number of expressions that don't need a destination at all. This
2323
// avoids needing a mountain of temporary `()` variables.
24-
let expr2 = expr.clone();
2524
match &expr.kind {
2625
ExprKind::Scope { region_scope, lint_level, value } => {
2726
this.in_scope((*region_scope, source_info), *lint_level, |this| {
@@ -35,7 +34,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
3534
// is better for borrowck interaction with overloaded
3635
// operators like x[j] = x[i].
3736

38-
debug!("stmt_expr Assign block_context.push(SubExpr) : {:?}", expr2);
37+
debug!("stmt_expr Assign block_context.push(SubExpr) : {:?}", expr);
3938
this.block_context.push(BlockFrame::SubExpr);
4039

4140
// Generate better code for things that don't need to be
@@ -64,7 +63,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6463

6564
let lhs_ty = lhs.ty;
6665

67-
debug!("stmt_expr AssignOp block_context.push(SubExpr) : {:?}", expr2);
66+
debug!("stmt_expr AssignOp block_context.push(SubExpr) : {:?}", expr);
6867
this.block_context.push(BlockFrame::SubExpr);
6968

7069
// As above, RTL.
@@ -102,7 +101,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
102101
this.break_scope(block, value.as_deref(), BreakableTarget::Return, source_info)
103102
}
104103
ExprKind::LlvmInlineAsm { asm, outputs, inputs } => {
105-
debug!("stmt_expr LlvmInlineAsm block_context.push(SubExpr) : {:?}", expr2);
104+
debug!("stmt_expr LlvmInlineAsm block_context.push(SubExpr) : {:?}", expr);
106105
this.block_context.push(BlockFrame::SubExpr);
107106
let outputs = outputs
108107
.into_iter()

compiler/rustc_mir_build/src/thir/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ crate enum LintLevel {
3232
Explicit(hir::HirId),
3333
}
3434

35-
#[derive(Clone, Debug)]
35+
#[derive(Debug)]
3636
crate struct Block<'tcx> {
3737
crate targeted_by_break: bool,
3838
crate region_scope: region::Scope,
@@ -51,13 +51,13 @@ crate enum BlockSafety {
5151
PopUnsafe,
5252
}
5353

54-
#[derive(Clone, Debug)]
54+
#[derive(Debug)]
5555
crate struct Stmt<'tcx> {
5656
crate kind: StmtKind<'tcx>,
5757
crate opt_destruction_scope: Option<region::Scope>,
5858
}
5959

60-
#[derive(Clone, Debug)]
60+
#[derive(Debug)]
6161
crate enum StmtKind<'tcx> {
6262
Expr {
6363
/// scope for this statement; may be used as lifetime of temporaries
@@ -107,7 +107,7 @@ rustc_data_structures::static_assert_size!(Expr<'_>, 160);
107107
/// MIR simplifications are already done in the impl of `Thir`. For
108108
/// example, method calls and overloaded operators are absent: they are
109109
/// expected to be converted into `Expr::Call` instances.
110-
#[derive(Clone, Debug)]
110+
#[derive(Debug)]
111111
crate struct Expr<'tcx> {
112112
/// type of this expression
113113
crate ty: Ty<'tcx>,
@@ -123,7 +123,7 @@ crate struct Expr<'tcx> {
123123
crate kind: ExprKind<'tcx>,
124124
}
125125

126-
#[derive(Clone, Debug)]
126+
#[derive(Debug)]
127127
crate enum ExprKind<'tcx> {
128128
Scope {
129129
region_scope: region::Scope,
@@ -312,19 +312,19 @@ crate enum ExprKind<'tcx> {
312312
},
313313
}
314314

315-
#[derive(Clone, Debug)]
315+
#[derive(Debug)]
316316
crate struct FieldExpr<'tcx> {
317317
crate name: Field,
318318
crate expr: Expr<'tcx>,
319319
}
320320

321-
#[derive(Clone, Debug)]
321+
#[derive(Debug)]
322322
crate struct FruInfo<'tcx> {
323323
crate base: Box<Expr<'tcx>>,
324324
crate field_types: Vec<Ty<'tcx>>,
325325
}
326326

327-
#[derive(Clone, Debug)]
327+
#[derive(Debug)]
328328
crate struct Arm<'tcx> {
329329
crate pattern: Pat<'tcx>,
330330
crate guard: Option<Guard<'tcx>>,
@@ -334,7 +334,7 @@ crate struct Arm<'tcx> {
334334
crate span: Span,
335335
}
336336

337-
#[derive(Clone, Debug)]
337+
#[derive(Debug)]
338338
crate enum Guard<'tcx> {
339339
If(Box<Expr<'tcx>>),
340340
IfLet(Pat<'tcx>, Box<Expr<'tcx>>),
@@ -346,7 +346,7 @@ crate enum LogicalOp {
346346
Or,
347347
}
348348

349-
#[derive(Clone, Debug)]
349+
#[derive(Debug)]
350350
crate enum InlineAsmOperand<'tcx> {
351351
In {
352352
reg: InlineAsmRegOrRegClass,

0 commit comments

Comments
 (0)