Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/fail/intrinsics/unchecked_shl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![feature(unchecked_math)]

fn main() {
unsafe {
let _n = 1i8.unchecked_shl(8);
//~^ ERROR: overflowing shift by 8 in `unchecked_shl`
}
}
15 changes: 15 additions & 0 deletions tests/fail/intrinsics/unchecked_shl.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: Undefined Behavior: overflowing shift by 8 in `unchecked_shl`
--> $DIR/unchecked_shl.rs:LL:CC
|
LL | let _n = 1i8.unchecked_shl(8);
| ^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shl`
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `main` at $DIR/unchecked_shl.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: Undefined Behavior: overflowing shift by 64 in `unchecked_shr`
--> $DIR/overflowing-unchecked-rsh.rs:LL:CC
--> $DIR/unchecked_shr.rs:LL:CC
|
LL | let _n = 1i64.unchecked_shr(64);
| ^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shr`
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `main` at $DIR/overflowing-unchecked-rsh.rs:LL:CC
= note: inside `main` at $DIR/unchecked_shr.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down