Remove Clone
impl for thir::Expr
This commit is contained in:
parent
2a2b4d7257
commit
a9f4dfc8fa
2 changed files with 13 additions and 14 deletions
|
@ -21,7 +21,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
let source_info = this.source_info(expr.span);
|
let source_info = this.source_info(expr.span);
|
||||||
// Handle a number of expressions that don't need a destination at all. This
|
// Handle a number of expressions that don't need a destination at all. This
|
||||||
// avoids needing a mountain of temporary `()` variables.
|
// avoids needing a mountain of temporary `()` variables.
|
||||||
let expr2 = expr.clone();
|
|
||||||
match &expr.kind {
|
match &expr.kind {
|
||||||
ExprKind::Scope { region_scope, lint_level, value } => {
|
ExprKind::Scope { region_scope, lint_level, value } => {
|
||||||
this.in_scope((*region_scope, source_info), *lint_level, |this| {
|
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
|
// is better for borrowck interaction with overloaded
|
||||||
// operators like x[j] = x[i].
|
// 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);
|
this.block_context.push(BlockFrame::SubExpr);
|
||||||
|
|
||||||
// Generate better code for things that don't need to be
|
// 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;
|
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);
|
this.block_context.push(BlockFrame::SubExpr);
|
||||||
|
|
||||||
// As above, RTL.
|
// As above, RTL.
|
||||||
|
@ -102,7 +101,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
this.break_scope(block, value.as_deref(), BreakableTarget::Return, source_info)
|
this.break_scope(block, value.as_deref(), BreakableTarget::Return, source_info)
|
||||||
}
|
}
|
||||||
ExprKind::LlvmInlineAsm { asm, outputs, inputs } => {
|
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);
|
this.block_context.push(BlockFrame::SubExpr);
|
||||||
let outputs = outputs
|
let outputs = outputs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
|
@ -32,7 +32,7 @@ crate enum LintLevel {
|
||||||
Explicit(hir::HirId),
|
Explicit(hir::HirId),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate struct Block<'tcx> {
|
crate struct Block<'tcx> {
|
||||||
crate targeted_by_break: bool,
|
crate targeted_by_break: bool,
|
||||||
crate region_scope: region::Scope,
|
crate region_scope: region::Scope,
|
||||||
|
@ -51,13 +51,13 @@ crate enum BlockSafety {
|
||||||
PopUnsafe,
|
PopUnsafe,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate struct Stmt<'tcx> {
|
crate struct Stmt<'tcx> {
|
||||||
crate kind: StmtKind<'tcx>,
|
crate kind: StmtKind<'tcx>,
|
||||||
crate opt_destruction_scope: Option<region::Scope>,
|
crate opt_destruction_scope: Option<region::Scope>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate enum StmtKind<'tcx> {
|
crate enum StmtKind<'tcx> {
|
||||||
Expr {
|
Expr {
|
||||||
/// scope for this statement; may be used as lifetime of temporaries
|
/// 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
|
/// MIR simplifications are already done in the impl of `Thir`. For
|
||||||
/// example, method calls and overloaded operators are absent: they are
|
/// example, method calls and overloaded operators are absent: they are
|
||||||
/// expected to be converted into `Expr::Call` instances.
|
/// expected to be converted into `Expr::Call` instances.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate struct Expr<'tcx> {
|
crate struct Expr<'tcx> {
|
||||||
/// type of this expression
|
/// type of this expression
|
||||||
crate ty: Ty<'tcx>,
|
crate ty: Ty<'tcx>,
|
||||||
|
@ -123,7 +123,7 @@ crate struct Expr<'tcx> {
|
||||||
crate kind: ExprKind<'tcx>,
|
crate kind: ExprKind<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate enum ExprKind<'tcx> {
|
crate enum ExprKind<'tcx> {
|
||||||
Scope {
|
Scope {
|
||||||
region_scope: region::Scope,
|
region_scope: region::Scope,
|
||||||
|
@ -312,19 +312,19 @@ crate enum ExprKind<'tcx> {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate struct FieldExpr<'tcx> {
|
crate struct FieldExpr<'tcx> {
|
||||||
crate name: Field,
|
crate name: Field,
|
||||||
crate expr: Expr<'tcx>,
|
crate expr: Expr<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate struct FruInfo<'tcx> {
|
crate struct FruInfo<'tcx> {
|
||||||
crate base: Box<Expr<'tcx>>,
|
crate base: Box<Expr<'tcx>>,
|
||||||
crate field_types: Vec<Ty<'tcx>>,
|
crate field_types: Vec<Ty<'tcx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate struct Arm<'tcx> {
|
crate struct Arm<'tcx> {
|
||||||
crate pattern: Pat<'tcx>,
|
crate pattern: Pat<'tcx>,
|
||||||
crate guard: Option<Guard<'tcx>>,
|
crate guard: Option<Guard<'tcx>>,
|
||||||
|
@ -334,7 +334,7 @@ crate struct Arm<'tcx> {
|
||||||
crate span: Span,
|
crate span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate enum Guard<'tcx> {
|
crate enum Guard<'tcx> {
|
||||||
If(Box<Expr<'tcx>>),
|
If(Box<Expr<'tcx>>),
|
||||||
IfLet(Pat<'tcx>, Box<Expr<'tcx>>),
|
IfLet(Pat<'tcx>, Box<Expr<'tcx>>),
|
||||||
|
@ -346,7 +346,7 @@ crate enum LogicalOp {
|
||||||
Or,
|
Or,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
crate enum InlineAsmOperand<'tcx> {
|
crate enum InlineAsmOperand<'tcx> {
|
||||||
In {
|
In {
|
||||||
reg: InlineAsmRegOrRegClass,
|
reg: InlineAsmRegOrRegClass,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue