Skip to content

Commit 2f1f7d9

Browse files
committed
---
yaml --- r: 188309 b: refs/heads/tmp c: b85b3c9 h: refs/heads/master i: 188307: 98d90fd v: v3
1 parent 26d54be commit 2f1f7d9

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
@@ -34,5 +34,5 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 522d09dfecbeca1595f25ac58c6d0178bbd21d7d
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: 8491c82c905d9b6d72742fd6dd0ec82c021bb800
37+
refs/heads/tmp: b85b3c9b2b018e8dd8685db3217faa72ab82b965
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/tmp/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)