You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `-Zub-checks` compiler flag enables additional runtime checks that detect some causes of Undefined Behavior at runtime.
6
+
By default, `-Zub-checks` flag inherits the value of `-Cdebug-assertions`.
7
+
8
+
All checks are generated on a best-effort basis; even if we have a check implemented for some cause of Undefined Behavior, it may be possible for the check to not fire.
9
+
If a dependency is compiled with `-Zub-checks=no` but the final binary or library is compiled with `-Zub-checks=yes`, UB checks reached by the dependency are likely to be optimized out.
10
+
11
+
When `-Zub-checks` detects UB, a non-unwinding panic is produced.
12
+
That means that we will not unwind the stack and will not call any `Drop` impls, but we will execute the configured panic hook.
13
+
We expect that unsafe code has been written which relies on code not unwinding which may have UB checks inserted.
14
+
Ergo, an unwinding panic could easily turn works-as-intended UB into a much bigger problem.
15
+
Calling the panic hook theoretically has the same implications, but we expect that the standard library panic hook will be stateless enough to be always called, and that if a user has configured a panic hook that the hook may be very helpful to debugging the detected UB.
0 commit comments