Skip to content

Commit b48274f

Browse files
committed
Use unreachable_unchecked in const_panic_fmt.
1 parent b64c4f9 commit b48274f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/core/src/panicking.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ pub const fn const_panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
100100
if let Some(msg) = fmt.as_str() {
101101
panic_str(msg);
102102
} else {
103-
panic_str("???");
103+
// SAFETY: This is only evaluated at compile time, which handles this
104+
// fine (in case it turns out this branch turns out to be reachable
105+
// somehow).
106+
unsafe { crate::hint::unreachable_unchecked() };
104107
}
105108
}
106109

0 commit comments

Comments
 (0)