Skip to content

Commit dca4b3c

Browse files
committed
---
yaml --- r: 277401 b: refs/heads/try c: d3c489c h: refs/heads/master i: 277399: bef097c
1 parent 54bbc65 commit dca4b3c

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
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: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 9d7ed99c06bbce263c4de56e269b62b135c5a6e1
4+
refs/heads/try: d3c489c917c1086728001c94a98765e02171a201
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_passes/consts.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
498498
Err(ConstEvalErr { kind: Math(ConstMathErr::Overflow(Op::Shl)), ..}) |
499499
Err(ConstEvalErr { kind: IndexOpFeatureGated, ..}) => {},
500500
Err(msg) => {
501-
self.qualif = self.qualif | ConstQualif::NOT_CONST;
502501
self.tcx.sess.add_lint(CONST_ERR, ex.id,
503502
msg.span,
504503
msg.description().into_owned())

branches/try/src/test/compile-fail/const-err.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// these errors are not actually "const_err", they occur in trans/consts
12+
// and are unconditional warnings that can't be denied or allowed
13+
1114
#![feature(rustc_attrs)]
1215
#![allow(exceeding_bitshifts)]
16+
#![allow(const_err)]
1317

1418
fn black_box<T>(_: T) {
1519
unimplemented!()
@@ -21,6 +25,7 @@ fn main() {
2125
//~^ WARN attempted to negate with overflow
2226
let b = 200u8 + 200u8 + 200u8;
2327
//~^ WARN attempted to add with overflow
28+
//~| WARN attempted to add with overflow
2429
let c = 200u8 * 4;
2530
//~^ WARN attempted to multiply with overflow
2631
let d = 42u8 - (42u8 + 1);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2012 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+
#![feature(rustc_attrs)]
12+
#![allow(exceeding_bitshifts)]
13+
#![deny(const_err)]
14+
15+
fn black_box<T>(_: T) {
16+
unimplemented!()
17+
}
18+
19+
fn main() {
20+
let a = -std::i8::MIN;
21+
//~^ ERROR attempted to negate with overflow
22+
let b = 200u8 + 200u8 + 200u8;
23+
//~^ ERROR attempted to add with overflow
24+
//~| ERROR attempted to add with overflow
25+
let c = 200u8 * 4;
26+
//~^ ERROR attempted to multiply with overflow
27+
let d = 42u8 - (42u8 + 1);
28+
//~^ ERROR attempted to subtract with overflow
29+
let _e = [5u8][1];
30+
black_box(a);
31+
black_box(b);
32+
black_box(c);
33+
black_box(d);
34+
}

0 commit comments

Comments
 (0)