File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( core_intrinsics) ]
2
+ use std:: intrinsics;
3
+
4
+ fn main ( ) {
5
+ unsafe {
6
+ let _n = intrinsics:: unchecked_shl ( 1i8 , -1 ) ;
7
+ //~^ ERROR: overflowing shift by -1 in `unchecked_shl`
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ error: Undefined Behavior: overflowing shift by -1 in `unchecked_shl`
2
+ --> $DIR/unchecked_shl2.rs:LL:CC
3
+ |
4
+ LL | let _n = intrinsics::unchecked_shl(1i8, -1);
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 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_shl2.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
+
You can’t perform that action at this time.
0 commit comments