Skip to content

Commit 8c15d31

Browse files
committed
---
yaml --- r: 44276 b: refs/heads/snap-stage3 c: f0d0b5c h: refs/heads/master v: v3
1 parent 9879982 commit 8c15d31

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f9f942bb142a36ce4c94181ae8d7f8dcf4160700
4+
refs/heads/snap-stage3: f0d0b5c116eb464544bd48cec116c1ec8908d04d
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4289,7 +4289,8 @@ pub fn eval_repeat_count(tcx: ctxt,
42894289
count_expr: @ast::expr,
42904290
span: span)
42914291
-> uint {
4292-
match const_eval::eval_const_expr(tcx, count_expr) {
4292+
match const_eval::eval_const_expr_partial(tcx, count_expr) {
4293+
Ok(ref const_val) => match *const_val {
42934294
const_eval::const_int(count) => return count as uint,
42944295
const_eval::const_uint(count) => return count as uint,
42954296
const_eval::const_float(count) => {
@@ -4310,7 +4311,13 @@ pub fn eval_repeat_count(tcx: ctxt,
43104311
repeat count but found boolean");
43114312
return 0;
43124313
}
4313-
4314+
},
4315+
Err(*) => {
4316+
tcx.sess.span_err(span,
4317+
~"expected constant integer for repeat count \
4318+
but found variable");
4319+
return 0;
4320+
}
43144321
}
43154322
}
43164323
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Regression test for issue #3645
12+
13+
fn main() {
14+
let n = 1;
15+
let a = ~[0, ..n]; //~ ERROR expected constant integer for repeat count but found variable
16+
}

0 commit comments

Comments
 (0)