Skip to content

Commit f91a136

Browse files
committed
---
yaml --- r: 193391 b: refs/heads/beta c: b85b3c9 h: refs/heads/master i: 193389: 465f727 193387: ebcf2fb 193383: 92ffb84 193375: 43b32cb v: v3
1 parent b092622 commit f91a136

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 8491c82c905d9b6d72742fd6dd0ec82c021bb800
34+
refs/heads/beta: b85b3c9b2b018e8dd8685db3217faa72ab82b965
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/src/librustc_typeck/astconv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
13991399
Err(ref r) => {
14001400
let subspan =
14011401
ast_ty.span.lo <= r.span.lo && r.span.hi <= ast_ty.span.hi;
1402-
span_err!(tcx.sess, ast_ty.span, E0250,
1402+
span_err!(tcx.sess, r.span, E0250,
14031403
"array length constant evaluation error: {}",
14041404
r.description().as_slice());
14051405
if !subspan {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2012-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+
// Check that an constant-evaluation underflow highlights the correct
12+
// spot (where the underflow occurred), while also providing the
13+
// overall context for what caused the evaluation.
14+
15+
const ONE: usize = 1;
16+
const TWO: usize = 2;
17+
const LEN: usize = ONE - TWO;
18+
//~^ ERROR array length constant evaluation error: attempted to sub with overflow [E0250]
19+
20+
fn main() {
21+
let a: [i8; LEN] = unimplemented!();
22+
//~^ NOTE for array length here
23+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2012-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+
// Check that an constant-evaluation underflow highlights the correct
12+
// spot (where the underflow occurred).
13+
14+
const ONE: usize = 1;
15+
const TWO: usize = 2;
16+
17+
fn main() {
18+
let a: [i8; ONE - TWO] = unimplemented!();
19+
//~^ ERROR array length constant evaluation error: attempted to sub with overflow [E0250]
20+
}

0 commit comments

Comments
 (0)