Skip to content

Commit 1748c91

Browse files
committed
---
yaml --- r: 195523 b: refs/heads/master c: 2243a2c h: refs/heads/master i: 195521: 371b891 195519: e04daae v: v3
1 parent ae1849b commit 1748c91

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1973f7ebe5c67ef9ed57f7a64781d13868a70d3d
2+
refs/heads/master: 2243a2cceddd6c9708e3d296b5375da72a6b3d2a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b3317d68910900f135f9f38e43a7a699bc736b4a
55
refs/heads/try: 961e0358e1a5c0faaef606e31e9965742c1643bf

trunk/src/librustc_trans/trans/consts.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -772,19 +772,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
772772
ast::ExprRepeat(ref elem, ref count) => {
773773
let unit_ty = ty::sequence_element_type(cx.tcx(), ety);
774774
let llunitty = type_of::type_of(cx, unit_ty);
775-
let n = match const_eval::eval_const_expr_partial(cx.tcx(), &**count, None) {
776-
Ok(const_eval::const_int(i)) => i as usize,
777-
Ok(const_eval::const_uint(i)) => i as usize,
778-
Ok(_) => {
779-
cx.sess().span_bug(count.span, "count must be integral const expression.")
780-
}
781-
Err(err) => {
782-
cx.sess().span_err(count.span, &format!("error evaluating count: {}",
783-
err.description()));
784-
// return 1 to allow compilation to proceed
785-
1 as usize
786-
}
787-
};
775+
let n = ty::eval_repeat_count(cx.tcx(), count);
788776
let unit_val = const_expr(cx, &**elem, param_substs).0;
789777
let vs: Vec<_> = repeat(unit_val).take(n).collect();
790778
if val_ty(unit_val) != llunitty {

0 commit comments

Comments
 (0)