Skip to content

Commit f97830a

Browse files
authored
Rollup merge of #136750 - kornelski:ub-bug, r=saethlin
Make ub_check message clear that it's not an assert I've seen a user assume that their unsound code was *safe*, because ub_check prevented the program from performing the unsafe operation. This PR makes the panic message clearer that ub_check is a bug detector, not run-time safety protection.
2 parents c50a337 + f40d3d0 commit f97830a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/fail/ptr_swap_nonoverlapping.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
33
unsafe precondition(s) violated: ptr::swap_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap
4+
5+
This indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.
46
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
57
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
68
thread caused non-unwinding panic. aborting.

0 commit comments

Comments
 (0)