Skip to content

Commit 5e8b883

Browse files
committed
Use unreachable_unchecked in const_panic_fmt.
1 parent c840027 commit 5e8b883

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/panicking.rs

Lines changed: 4 additions & 1 deletion
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)