rust/library/core/src/ptr
bors 768408af12 Auto merge of #121662 - saethlin:precondition-unification, r=RalfJung
Distinguish between library and lang UB in assert_unsafe_precondition

As described in https://github.com/rust-lang/rust/pull/121583#issuecomment-1963168186, `assert_unsafe_precondition` now explicitly distinguishes between language UB (conditions we explicitly optimize on) and library UB (things we document you shouldn't do, and maybe some library internals assume you don't do).

`debug_assert_nounwind` was originally added to avoid the "only at runtime" aspect of `assert_unsafe_precondition`. Since then the difference between the macros has gotten muddied. This totally revamps the situation.

Now _all_ preconditions shall be checked with `assert_unsafe_precondition`. If you have a precondition that's only checkable at runtime, do a `const_eval_select` hack, as done in this PR.

r? RalfJung
2024-03-10 01:23:54 +00:00
..
alignment.rs Distinguish between library and lang UB in assert_unsafe_precondition 2024-03-08 18:53:58 -05:00
const_ptr.rs Auto merge of #121662 - saethlin:precondition-unification, r=RalfJung 2024-03-10 01:23:54 +00:00
metadata.rs Fix typo in metadata.rs doc comment 2024-02-22 09:30:03 +01:00
mod.rs Improve docs 2024-03-09 10:49:26 -05:00
mut_ptr.rs fn is_align_to: move some comments closer to the cast they refer to 2024-03-09 11:54:27 +01:00
non_null.rs Distinguish between library and lang UB in assert_unsafe_precondition 2024-03-08 18:53:58 -05:00
unique.rs Add and use Unique::as_non_null_ptr 2024-02-08 19:56:30 -05:00