Skip to content

Commit fee7896

Browse files
committed
---
yaml --- r: 274128 b: refs/heads/stable c: d31027d h: refs/heads/master
1 parent 3f19108 commit fee7896

File tree

7 files changed

+19
-11
lines changed

7 files changed

+19
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: c78609134c7cef5a616943e5ec79cfc0ce946140
32+
refs/heads/stable: d31027d3bf9003f376d7f73df90cb4592d81084a
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc/mir/repr.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ pub enum Rvalue<'tcx> {
683683
Use(Operand<'tcx>),
684684

685685
// [x; 32]
686-
Repeat(Operand<'tcx>, Constant<'tcx>),
686+
Repeat(Operand<'tcx>, TypedConstVal<'tcx>),
687687

688688
// &x or &mut x
689689
Ref(Region, BorrowKind, Lvalue<'tcx>),
@@ -891,6 +891,13 @@ pub struct Constant<'tcx> {
891891
pub literal: Literal<'tcx>,
892892
}
893893

894+
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
895+
pub struct TypedConstVal<'tcx> {
896+
pub ty: Ty<'tcx>,
897+
pub span: Span,
898+
pub value: ConstVal
899+
}
900+
894901
#[derive(Clone, Copy, Debug, PartialEq, RustcEncodable, RustcDecodable)]
895902
pub enum ItemKind {
896903
Constant,

branches/stable/src/librustc/mir/visit.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,8 @@ macro_rules! make_mir_visitor {
213213
}
214214

215215
Rvalue::Repeat(ref $($mutability)* value,
216-
ref $($mutability)* len) => {
216+
_) => {
217217
self.visit_operand(value);
218-
self.visit_constant(len);
219218
}
220219

221220
Rvalue::Ref(r, bk, ref $($mutability)* path) => {

branches/stable/src/librustc_mir/hair/cx/expr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use hair::cx::block;
1515
use hair::cx::to_ref::ToRef;
1616
use rustc::front::map;
1717
use rustc::middle::def::Def;
18+
use rustc::middle::const_eval;
1819
use rustc::middle::region::CodeExtent;
1920
use rustc::middle::pat_util;
2021
use rustc::middle::ty::{self, VariantDef, Ty};
@@ -325,10 +326,10 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
325326

326327
hir::ExprRepeat(ref v, ref c) => ExprKind::Repeat {
327328
value: v.to_ref(),
328-
count: Constant {
329+
count: TypedConstVal {
329330
ty: cx.tcx.expr_ty(c),
330331
span: c.span,
331-
literal: cx.const_eval_literal(c)
332+
value: const_eval::eval_const_expr(cx.tcx, c)
332333
}
333334
},
334335
hir::ExprRet(ref v) =>

branches/stable/src/librustc_mir/hair/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
//! unit-tested and separated from the Rust source and compiler data
1515
//! structures.
1616
17-
use rustc::mir::repr::{Constant, BinOp, BorrowKind, Field, Literal, Mutability, UnOp, ItemKind};
17+
use rustc::mir::repr::{BinOp, BorrowKind, Field, Literal, Mutability, UnOp, ItemKind,
18+
TypedConstVal};
1819
use rustc::middle::const_eval::ConstVal;
1920
use rustc::middle::def_id::DefId;
2021
use rustc::middle::region::CodeExtent;
@@ -213,7 +214,7 @@ pub enum ExprKind<'tcx> {
213214
},
214215
Repeat {
215216
value: ExprRef<'tcx>,
216-
count: Constant<'tcx>,
217+
count: TypedConstVal<'tcx>,
217218
},
218219
Vec {
219220
fields: Vec<ExprRef<'tcx>>,
@@ -338,6 +339,7 @@ pub struct FieldPattern<'tcx> {
338339
pub field: Field,
339340
pub pattern: Pattern<'tcx>,
340341
}
342+
341343
///////////////////////////////////////////////////////////////////////////
342344
// The Mirror trait
343345

branches/stable/src/librustc_mir/transform/erase_regions.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ impl<'a, 'tcx> EraseRegions<'a, 'tcx> {
143143
Rvalue::Use(ref mut operand) => {
144144
self.erase_regions_operand(operand)
145145
}
146-
Rvalue::Repeat(ref mut operand, ref mut constant) => {
146+
Rvalue::Repeat(ref mut operand, _) => {
147147
self.erase_regions_operand(operand);
148-
self.erase_regions_constant(constant);
149148
}
150149
Rvalue::Ref(ref mut region, _, ref mut lvalue) => {
151150
*region = ty::ReStatic;

branches/stable/src/librustc_trans/trans/mir/rvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
8989

9090
mir::Rvalue::Repeat(ref elem, ref count) => {
9191
let elem = self.trans_operand(bcx, elem);
92-
let size = self.trans_constant(bcx, count).immediate();
92+
let size = self.trans_constval(bcx, &count.value, count.ty).immediate();
9393
let base = expr::get_dataptr(bcx, dest.llval);
9494
tvec::iter_vec_raw(bcx, base, elem.ty, size, |bcx, llslot, _| {
9595
self.store_operand(bcx, llslot, elem);

0 commit comments

Comments
 (0)