Skip to content

Commit bef097c

Browse files
committed
---
yaml --- r: 277399 b: refs/heads/try c: 89d1046 h: refs/heads/master i: 277397: 35635c2 277395: 5d1c9b9 277391: 159f52a
1 parent 47e1b17 commit bef097c

File tree

5 files changed

+7
-23
lines changed

5 files changed

+7
-23
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: 735c018974e5570ea13fd887aa70a011a5b8e7b8
4+
refs/heads/try: 89d1046503b2721e7a372f24eb7ef5998d9dd176
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_const_math/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ mod err;
4040
pub use int::*;
4141
pub use us::*;
4242
pub use is::*;
43-
pub use err::ConstMathErr;
43+
pub use err::{ConstMathErr, Op};

branches/try/src/librustc_passes/consts.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ use rustc::dep_graph::DepNode;
2828
use rustc::ty::cast::{CastKind};
2929
use rustc_const_eval::{ConstEvalErr, lookup_const_fn_by_id, compare_lit_exprs};
3030
use rustc_const_eval::{eval_const_expr_partial, lookup_const_by_id};
31-
use rustc_const_eval::ErrKind::{IndexOpFeatureGated, UnimplementedConstVal, MiscCatchAll};
3231
use rustc_const_eval::ErrKind::{ErroneousReferencedConstant, MiscBinaryOp};
32+
use rustc_const_eval::ErrKind::{IndexOpFeatureGated, UnimplementedConstVal, MiscCatchAll, Math};
3333
use rustc_const_eval::EvalHint::ExprTypeChecked;
34+
use rustc_const_math::{ConstMathErr, Op};
3435
use rustc::hir::def::Def;
3536
use rustc::hir::def_id::DefId;
3637
use rustc::middle::expr_use_visitor as euv;
@@ -490,6 +491,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
490491
Err(ConstEvalErr { kind: MiscCatchAll, ..}) |
491492
Err(ConstEvalErr { kind: MiscBinaryOp, ..}) |
492493
Err(ConstEvalErr { kind: ErroneousReferencedConstant(_), ..}) |
494+
Err(ConstEvalErr { kind: Math(ConstMathErr::Overflow(Op::Shr)), ..}) |
495+
Err(ConstEvalErr { kind: Math(ConstMathErr::Overflow(Op::Shl)), ..}) |
493496
Err(ConstEvalErr { kind: IndexOpFeatureGated, ..}) => {},
494497
Err(msg) => {
495498
self.qualif = self.qualif | ConstQualif::NOT_CONST;

branches/try/src/librustc_passes/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
extern crate core;
3131
#[macro_use] extern crate rustc;
3232
extern crate rustc_const_eval;
33+
extern crate rustc_const_math;
3334

3435
#[macro_use] extern crate log;
3536
#[macro_use] extern crate syntax;

branches/try/src/test/compile-fail/lint-exceeding-bitshifts.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,53 +16,37 @@
1616
fn main() {
1717
let n = 1u8 << 7;
1818
let n = 1u8 << 8; //~ ERROR: bitshift exceeds the type's number of bits
19-
//~^ WARN: attempted to shift left with overflow
2019
let n = 1u16 << 15;
2120
let n = 1u16 << 16; //~ ERROR: bitshift exceeds the type's number of bits
22-
//~^ WARN: attempted to shift left with overflow
2321
let n = 1u32 << 31;
2422
let n = 1u32 << 32; //~ ERROR: bitshift exceeds the type's number of bits
25-
//~^ WARN: attempted to shift left with overflow
2623
let n = 1u64 << 63;
2724
let n = 1u64 << 64; //~ ERROR: bitshift exceeds the type's number of bits
28-
//~^ WARN: attempted to shift left with overflow
2925
let n = 1i8 << 7;
3026
let n = 1i8 << 8; //~ ERROR: bitshift exceeds the type's number of bits
31-
//~^ WARN: attempted to shift left with overflow
3227
let n = 1i16 << 15;
3328
let n = 1i16 << 16; //~ ERROR: bitshift exceeds the type's number of bits
34-
//~^ WARN: attempted to shift left with overflow
3529
let n = 1i32 << 31;
3630
let n = 1i32 << 32; //~ ERROR: bitshift exceeds the type's number of bits
37-
//~^ WARN: attempted to shift left with overflow
3831
let n = 1i64 << 63;
3932
let n = 1i64 << 64; //~ ERROR: bitshift exceeds the type's number of bits
40-
//~^ WARN: attempted to shift left with overflow
4133

4234
let n = 1u8 >> 7;
4335
let n = 1u8 >> 8; //~ ERROR: bitshift exceeds the type's number of bits
44-
//~^ WARN: attempted to shift right with overflow
4536
let n = 1u16 >> 15;
4637
let n = 1u16 >> 16; //~ ERROR: bitshift exceeds the type's number of bits
47-
//~^ WARN: attempted to shift right with overflow
4838
let n = 1u32 >> 31;
4939
let n = 1u32 >> 32; //~ ERROR: bitshift exceeds the type's number of bits
50-
//~^ WARN: attempted to shift right with overflow
5140
let n = 1u64 >> 63;
5241
let n = 1u64 >> 64; //~ ERROR: bitshift exceeds the type's number of bits
53-
//~^ WARN: attempted to shift right with overflow
5442
let n = 1i8 >> 7;
5543
let n = 1i8 >> 8; //~ ERROR: bitshift exceeds the type's number of bits
56-
//~^ WARN: attempted to shift right with overflow
5744
let n = 1i16 >> 15;
5845
let n = 1i16 >> 16; //~ ERROR: bitshift exceeds the type's number of bits
59-
//~^ WARN: attempted to shift right with overflow
6046
let n = 1i32 >> 31;
6147
let n = 1i32 >> 32; //~ ERROR: bitshift exceeds the type's number of bits
62-
//~^ WARN: attempted to shift right with overflow
6348
let n = 1i64 >> 63;
6449
let n = 1i64 >> 64; //~ ERROR: bitshift exceeds the type's number of bits
65-
//~^ WARN: attempted to shift right with overflow
6650

6751
let n = 1u8;
6852
let n = n << 7;
@@ -73,22 +57,18 @@ fn main() {
7357

7458
let n = 1u8 << (4+3);
7559
let n = 1u8 << (4+4); //~ ERROR: bitshift exceeds the type's number of bits
76-
//~^ WARN: attempted to shift left with overflow
7760

7861
#[cfg(target_pointer_width = "32")]
7962
const BITS: usize = 32;
8063
#[cfg(target_pointer_width = "64")]
8164
const BITS: usize = 64;
8265

8366
let n = 1_isize << BITS; //~ ERROR: bitshift exceeds the type's number of bits
84-
//~^ WARN: attempted to shift left with overflow
8567
let n = 1_usize << BITS; //~ ERROR: bitshift exceeds the type's number of bits
86-
//~^ WARN: attempted to shift left with overflow
8768

8869

8970
let n = 1i8<<(1isize+-1);
9071

9172
let n = 1i64 >> [63][0];
9273
let n = 1i64 >> [64][0]; //~ ERROR: bitshift exceeds the type's number of bits
93-
//~^ WARN: attempted to shift right with overflow
9474
}

0 commit comments

Comments
 (0)