From 2986cc0ef2f40e15780023da2a20b63a42a639a8 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sun, 1 Sep 2024 17:15:40 -0400 Subject: [PATCH] cfg out the check in write --- library/core/src/ptr/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index ab2c8a482dd0..12bb79a89e18 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1634,6 +1634,7 @@ 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)] ub_checks::assert_unsafe_precondition!( check_language_ub, "ptr::write requires that the pointer argument is aligned and non-null",