Skip to content

Commit 0d2582b

Browse files
committed
---
yaml --- r: 188336 b: refs/heads/master c: b85b3c9 h: refs/heads/master v: v3
1 parent 935335c commit 0d2582b

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 8491c82c905d9b6d72742fd6dd0ec82c021bb800
2+
refs/heads/master: b85b3c9b2b018e8dd8685db3217faa72ab82b965
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
55
refs/heads/try: 649d35e4d830b27806705dc5352c86ab6d6fd1a1

trunk/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)