File tree Expand file tree Collapse file tree 4 files changed +25
-2
lines changed
src/tools/miri/tests/fail/intrinsics Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( unchecked_math) ]
2+
3+ fn main ( ) {
4+ unsafe {
5+ let _n = 1i8 . unchecked_shl ( 8 ) ;
6+ //~^ ERROR: overflowing shift by 8 in `unchecked_shl`
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ error: Undefined Behavior: overflowing shift by 8 in `unchecked_shl`
2+ --> $DIR/unchecked_shl.rs:LL:CC
3+ |
4+ LL | let _n = 1i8.unchecked_shl(8);
5+ | ^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shl`
6+ |
7+ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8+ = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9+ = note: BACKTRACE:
10+ = note: inside `main` at $DIR/unchecked_shl.rs:LL:CC
11+
12+ note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
13+
14+ error: aborting due to previous error
15+
File renamed without changes.
Original file line number Diff line number Diff line change 11error: Undefined Behavior: overflowing shift by 64 in `unchecked_shr`
2- --> $DIR/overflowing-unchecked-rsh .rs:LL:CC
2+ --> $DIR/unchecked_shr .rs:LL:CC
33 |
44LL | let _n = 1i64.unchecked_shr(64);
55 | ^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shr`
66 |
77 = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88 = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99 = note: BACKTRACE:
10- = note: inside `main` at $DIR/overflowing-unchecked-rsh .rs:LL:CC
10+ = note: inside `main` at $DIR/unchecked_shr .rs:LL:CC
1111
1212note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1313
You can’t perform that action at this time.
0 commit comments