Skip to content

Commit

Permalink
raw_eq: using it on bytes with provenance is not UB (outside const-eval)
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 31, 2024
1 parent 787a1f7 commit da48417
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2436,11 +2436,13 @@ extern "rust-intrinsic" {
///
/// # Safety
///
/// It's UB to call this if any of the *bytes* in `*a` or `*b` are uninitialized or carry a
/// pointer value.
/// It's UB to call this if any of the *bytes* in `*a` or `*b` are uninitialized.
/// Note that this is a stricter criterion than just the *values* being
/// fully-initialized: if `T` has padding, it's UB to call this intrinsic.
///
/// At compile-time, it is furthermore UB to call this if any of the bytes
/// in `*a` or `*b` have provenance.
///
/// (The implementation is allowed to branch on the results of comparisons,
/// which is UB if any of their inputs are `undef`.)
#[rustc_const_unstable(feature = "const_intrinsic_raw_eq", issue = "none")]
Expand Down

0 comments on commit da48417

Please sign in to comment.