From da484175cbde3ef64cac950b2d79f1ff61fcb02e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 31 Jul 2024 20:26:08 +0200 Subject: [PATCH] raw_eq: using it on bytes with provenance is not UB (outside const-eval) --- core/src/intrinsics.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/intrinsics.rs b/core/src/intrinsics.rs index 13c7f0855d8f0..e9eacbcd25a0a 100644 --- a/core/src/intrinsics.rs +++ b/core/src/intrinsics.rs @@ -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")]