From fbf9acf434b665e698bef1fb94cedddd4eb9b919 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Tue, 9 Apr 2024 10:36:31 -0400 Subject: [PATCH] Disable assert_unsafe_precondition to measure compile-time cost --- library/core/src/ub_checks.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/core/src/ub_checks.rs b/library/core/src/ub_checks.rs index ff6b2d3053956..b8c2a9ddbcc12 100644 --- a/library/core/src/ub_checks.rs +++ b/library/core/src/ub_checks.rs @@ -69,9 +69,11 @@ macro_rules! assert_unsafe_precondition { } } + if cfg!(debug_assertions) { if ::core::ub_checks::$kind() { precondition_check($($arg,)*); } + } } }; }