From 0a65e30efefe3f40077e2777966924f97fab3f28 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Fri, 23 Aug 2024 23:50:07 -0400 Subject: [PATCH] Try enabling precondition checks on ptr::{read,write} --- library/core/src/ptr/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 3fe5212cea779..97eeea9232f96 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1387,7 +1387,6 @@ pub const unsafe fn read(src: *const T) -> T { // SAFETY: the caller must guarantee that `src` is valid for reads. unsafe { - #[cfg(debug_assertions)] // Too expensive to always enable (for now?) ub_checks::assert_unsafe_precondition!( check_language_ub, "ptr::read requires that the pointer argument is aligned and non-null", @@ -1596,7 +1595,6 @@ pub const unsafe fn write(dst: *mut T, src: T) { // `dst` cannot overlap `src` because the caller has mutable access // to `dst` while `src` is owned by this function. unsafe { - #[cfg(debug_assertions)] // Too expensive to always enable (for now?) ub_checks::assert_unsafe_precondition!( check_language_ub, "ptr::write requires that the pointer argument is aligned and non-null",