Skip to content

Commit

Permalink
add debug assertion to unreachable_unchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
ibraheemdev committed Dec 12, 2021
1 parent e70e4d4 commit 7675a50
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ use crate::intrinsics;
#[stable(feature = "unreachable", since = "1.27.0")]
#[rustc_const_stable(feature = "const_unreachable_unchecked", since = "1.57.0")]
pub const unsafe fn unreachable_unchecked() -> ! {
debug_assert!(false, "entered unreachable code");
// SAFETY: the safety contract for `intrinsics::unreachable` must
// be upheld by the caller.
unsafe { intrinsics::unreachable() }
Expand Down

0 comments on commit 7675a50

Please sign in to comment.