-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
libc-test panic: unsafe precondition(s) violated: hint::assert_unchecked must never be called when the condition is false
#120910
Comments
unsafe precondition(s) violated: hint::assert_unchecked must never be called when the condition is false
unsafe precondition(s) violated: hint::assert_unchecked must never be called when the condition is false
Probably because the condition is now being checked in debug mode even without build-std: #120594 I am inclined to say this is a bug in the calling code. |
this code is incorrect, it's calling |
Thanks for clarifying! Going to close as wontfix then (the linked code is quite old rustc_syntax and yes, it's time that we have to update our test method 😓). |
This is an old pattern that I rooted out of the compiler when I first worked on these checks about a year ago. We've also since stabilized |
Also, while blame says that line is 9 years old (👀), today this is documented
https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.get_unchecked |
The previous use of `get_unchecked` was UB according to https://doc.rust-lang.org/nightly/std/primitive.slice.html#safety-2 and rust-lang/rust#120594 exposed this leading to a panic caught by out tests as: ``` cargo test --all ... thread 'fold::tests::ident_transformation_in_defs' panicked at library/core/src/panicking.rs:155:5: unsafe precondition(s) violated: hint::assert_unchecked must never be called when the condition is false thread caused non-unwinding panic. aborting. error: test failed, to rerun pass `-p garando_syntax --lib` ... ``` Fixes rust-lang/rust#120910
libc-test now panics since
1.78.0-nightly (d44e3b95c 2024-02-09)
.Code
repo: https://github.com/rust-lang/libc
example GHA run: https://github.com/rust-lang/libc/actions/runs/7852817358/job/21431727248
Not minimized yet.
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: