-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add debug assertion to unreachable_unchecked
#90915
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
I'd like to understand better whether this specific Would it make sense for us to make this |
It wouldn't even get codegen'd - std is not shipped with debug assertions on, so it shouldn't get generated anywhere. I'd probably implement this as an explicit cfg(...) around a panic, though, rather than debug_assert with a false argument. |
Why is this failing? |
How about |
@@ -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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a suggestion, to be more informative
debug_assert!(false, "entered unreachable code"); | |
debug_assert!(false, "called `unreachable_unchecked`"); |
See #51713 for discussion about adding debug asserts to |
ping from triage: @rustbot label: +S-waiting-on-author -S-waiting-on-review |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Ping from triage: |
I guess the test should check for the panic then? The problem will rather be that behavior differs depending on how the standard library is compiled. For codegen tests we have |
@ibraheemdev @rustbot label: +S-inactive |
No description provided.