Rollup merge of #129551 - RalfJung:ub-checks-fallback, r=saethlin · patricklam/verify-rust-std@1d44fab (original) (raw)

Original file line number Diff line number Diff line change
@@ -2949,15 +2949,15 @@ pub const unsafe fn typed_swap(x: *mut T, y: *mut T) {
2949 2949 /// sysroot which is built without ub_checks but with `#[rustc_preserve_ub_checks]`.
2950 2950 /// For code that gets monomorphized in the user crate (i.e., generic functions and functions with
2951 2951 /// `#[inline]`), gating assertions on `ub_checks()` rather than `cfg!(ub_checks)` means that
2952 -/// assertions are enabled whenever the *user crate* has UB checks enabled. However if the
2952 +/// assertions are enabled whenever the *user crate* has UB checks enabled. However, if the
2953 2953 /// user has UB checks disabled, the checks will still get optimized out. This intrinsic is
2954 2954 /// primarily used by [`ub_checks::assert_unsafe_precondition`].
2955 2955 #[rustc_const_unstable(feature = "const_ub_checks", issue = "none")]
2956 2956 #[unstable(feature = "core_intrinsics", issue = "none")]
2957 2957 #[inline(always)]
2958 2958 #[rustc_intrinsic]
2959 2959 pub const fn ub_checks() -> bool {
2960 -cfg!(debug_assertions)
2960 +cfg!(ub_checks)
2961 2961 }
2962 2962
2963 2963 /// Allocates a block of memory at compile time.