From f9becad7dd4b02229a8a9257e047a1d8c7c4bb4a Mon Sep 17 00:00:00 2001 From: BioTomateDE Date: Sat, 21 Nov 2026 09:31:41 +0000 Subject: [PATCH] use `cfg!(overflow_checks)` in `overflow_checks` intrinsic instead of `cfg!(debug_assertions)` * use `cfg!(overflow_checks)` in `overflow_checks` intrinsic instead of `cfg!(debug_assertions)` * add missing `cfg_overflow_checks` feature --- library/core/src/intrinsics/mod.rs | 2 +- library/core/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 5c20f4a93fb2e..a1153e61bb873 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -2701,7 +2701,7 @@ pub const fn ub_checks() -> bool { #[inline(always)] #[rustc_intrinsic] pub const fn overflow_checks() -> bool { - cfg!(debug_assertions) + cfg!(overflow_checks) } /// Allocates a block of memory at compile time. diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 7f0f250a96486..d1d15c974c0d4 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -110,6 +110,7 @@ #![feature(allow_internal_unstable)] #![feature(arbitrary_self_types_pointers)] #![feature(auto_traits)] +#![feature(cfg_overflow_checks)] #![feature(cfg_sanitize)] #![feature(cfg_target_has_atomic)] #![feature(cfg_ub_checks)]