Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions library/core/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2502,14 +2502,6 @@ pub(crate) macro const_eval_select {
/// particular value, ever. However, the compiler will generally make it
/// return `true` only if the value of the argument is actually known.
///
/// # Stability concerns
///
/// While it is safe to call, this intrinsic may behave differently in
/// a `const` context than otherwise. See the [`const_eval_select()`]
/// documentation for an explanation of the issues this can cause. Unlike
/// `const_eval_select`, this intrinsic isn't guaranteed to behave
/// deterministically even in a `const` context.
///
/// # Type Requirements
///
/// `T` must be either a `bool`, a `char`, a primitive numeric type (e.g. `f32`,
Expand Down Expand Up @@ -2590,6 +2582,12 @@ pub const unsafe fn typed_swap_nonoverlapping<T>(x: *mut T, y: *mut T) {
/// assertions are enabled whenever the *user crate* has UB checks enabled. However, if the
/// user has UB checks disabled, the checks will still get optimized out. This intrinsic is
/// primarily used by [`crate::ub_checks::assert_unsafe_precondition`].
///
/// # Consteval
///
/// In consteval, this function currently returns `true`. This is because the value of the `ub_checks`
/// configuration can differ across crates, but we need this function to always return the same
/// value in consteval in order to avoid unsoundness.
#[rustc_intrinsic_const_stable_indirect] // just for UB checks
#[inline(always)]
#[rustc_intrinsic]
Expand All @@ -2609,6 +2607,12 @@ pub const fn ub_checks() -> bool {
/// `#[inline]`), gating assertions on `overflow_checks()` rather than `cfg!(overflow_checks)` means that
/// assertions are enabled whenever the *user crate* has overflow checks enabled. However if the
/// user has overflow checks disabled, the checks will still get optimized out.
///
/// # Consteval
///
/// In consteval, this function currently returns `true`. This is because the value of the `overflow_checks`
/// configuration can differ across crates, but we need this function to always return the same
/// value in consteval in order to avoid unsoundness.
#[inline(always)]
#[rustc_intrinsic]
pub const fn overflow_checks() -> bool {
Expand Down
Loading