[MIR] use mir::repr::Constant in ExprKind::Repeat, close #29789
This commit is contained in:
parent
9ae76b363c
commit
c78609134c
src/librustc_mir
@ -44,7 +44,6 @@ impl<'a,'tcx> Builder<'a,'tcx> {
|
||||
}
|
||||
ExprKind::Repeat { value, count } => {
|
||||
let value_operand = unpack!(block = this.as_operand(block, value));
|
||||
let count = this.as_constant(count);
|
||||
block.and(Rvalue::Repeat(value_operand, count))
|
||||
}
|
||||
ExprKind::Borrow { region, borrow_kind, arg } => {
|
||||
|
@ -325,14 +325,11 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
|
||||
|
||||
hir::ExprRepeat(ref v, ref c) => ExprKind::Repeat {
|
||||
value: v.to_ref(),
|
||||
count: Expr {
|
||||
count: Constant {
|
||||
ty: cx.tcx.expr_ty(c),
|
||||
temp_lifetime: None,
|
||||
span: c.span,
|
||||
kind: ExprKind::Literal {
|
||||
literal: cx.const_eval_literal(c)
|
||||
}
|
||||
}.to_ref()
|
||||
literal: cx.const_eval_literal(c)
|
||||
}
|
||||
},
|
||||
hir::ExprRet(ref v) =>
|
||||
ExprKind::Return { value: v.to_ref() },
|
||||
|
@ -14,7 +14,7 @@
|
||||
//! unit-tested and separated from the Rust source and compiler data
|
||||
//! structures.
|
||||
|
||||
use rustc::mir::repr::{BinOp, BorrowKind, Field, Literal, Mutability, UnOp, ItemKind};
|
||||
use rustc::mir::repr::{Constant, BinOp, BorrowKind, Field, Literal, Mutability, UnOp, ItemKind};
|
||||
use rustc::middle::const_eval::ConstVal;
|
||||
use rustc::middle::def_id::DefId;
|
||||
use rustc::middle::region::CodeExtent;
|
||||
@ -213,10 +213,7 @@ pub enum ExprKind<'tcx> {
|
||||
},
|
||||
Repeat {
|
||||
value: ExprRef<'tcx>,
|
||||
// FIXME(#29789): Add a separate hair::Constant<'tcx> so this could be more explicit about
|
||||
// its contained data. Currently this should only contain expression of ExprKind::Literal
|
||||
// kind.
|
||||
count: ExprRef<'tcx>,
|
||||
count: Constant<'tcx>,
|
||||
},
|
||||
Vec {
|
||||
fields: Vec<ExprRef<'tcx>>,
|
||||
@ -341,7 +338,6 @@ pub struct FieldPattern<'tcx> {
|
||||
pub field: Field,
|
||||
pub pattern: Pattern<'tcx>,
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// The Mirror trait
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user