diff --git a/src/tools/miri/tests/fail/intrinsics/unchecked_shl.rs b/src/tools/miri/tests/fail/intrinsics/unchecked_shl.rs new file mode 100644 index 00000000000..4554d0cb82b --- /dev/null +++ b/src/tools/miri/tests/fail/intrinsics/unchecked_shl.rs @@ -0,0 +1,8 @@ +#![feature(unchecked_math)] + +fn main() { + unsafe { + let _n = 1i8.unchecked_shl(8); + //~^ ERROR: overflowing shift by 8 in `unchecked_shl` + } +} diff --git a/src/tools/miri/tests/fail/intrinsics/unchecked_shl.stderr b/src/tools/miri/tests/fail/intrinsics/unchecked_shl.stderr new file mode 100644 index 00000000000..264e9baf053 --- /dev/null +++ b/src/tools/miri/tests/fail/intrinsics/unchecked_shl.stderr @@ -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 + diff --git a/src/tools/miri/tests/fail/intrinsics/overflowing-unchecked-rsh.rs b/src/tools/miri/tests/fail/intrinsics/unchecked_shr.rs similarity index 100% rename from src/tools/miri/tests/fail/intrinsics/overflowing-unchecked-rsh.rs rename to src/tools/miri/tests/fail/intrinsics/unchecked_shr.rs diff --git a/src/tools/miri/tests/fail/intrinsics/overflowing-unchecked-rsh.stderr b/src/tools/miri/tests/fail/intrinsics/unchecked_shr.stderr similarity index 84% rename from src/tools/miri/tests/fail/intrinsics/overflowing-unchecked-rsh.stderr rename to src/tools/miri/tests/fail/intrinsics/unchecked_shr.stderr index 9c5d0d13108..378ff9734c1 100644 --- a/src/tools/miri/tests/fail/intrinsics/overflowing-unchecked-rsh.stderr +++ b/src/tools/miri/tests/fail/intrinsics/unchecked_shr.stderr @@ -1,5 +1,5 @@ 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` @@ -7,7 +7,7 @@ LL | let _n = 1i64.unchecked_shr(64); = 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