Skip to content

Commit e01077a

Browse files
committed
PR feedback
- Add `:Sized` assertion in interpreter impl - Use `Scalar::from_bool` instead of `ScalarInt: From<bool>` - Remove unneeded comparison in intrinsic typeck - Make this UB to call with undef, not just return undef in that case
1 parent 15e1800 commit e01077a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/src/intrinsics.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,8 +1924,12 @@ extern "rust-intrinsic" {
19241924
///
19251925
/// # Safety
19261926
///
1927-
/// This doesn't take into account padding, so if `T` has padding
1928-
/// the result will be `undef`, which cannot be exposed to safe code.
1927+
/// It's UB to call this if any of the *bytes* in `*a` or `*b` are uninitialized.
1928+
/// Note that this is a stricter criterion than just the *values* being
1929+
/// fully-initialized: if `T` has padding, it's UB to call this intrinsic.
1930+
///
1931+
/// (The implementation is allowed to branch on the results of comparisons,
1932+
/// which is UB if any of their inputs are `undef`.)
19291933
#[cfg(not(bootstrap))]
19301934
#[rustc_const_unstable(feature = "const_intrinsic_raw_eq", issue = "none")]
19311935
pub fn raw_eq<T>(a: &T, b: &T) -> bool;

0 commit comments

Comments
 (0)