Skip to content

Commit 18bf9ce

Browse files
committed
Try enabling precondition checks on ptr::{read,write}
1 parent 784d444 commit 18bf9ce

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

library/core/src/ptr/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,6 @@ pub const unsafe fn read<T>(src: *const T) -> T {
14251425

14261426
// SAFETY: the caller must guarantee that `src` is valid for reads.
14271427
unsafe {
1428-
#[cfg(debug_assertions)] // Too expensive to always enable (for now?)
14291428
ub_checks::assert_unsafe_precondition!(
14301429
check_language_ub,
14311430
"ptr::read requires that the pointer argument is aligned and non-null",
@@ -1634,7 +1633,6 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
16341633
// `dst` cannot overlap `src` because the caller has mutable access
16351634
// to `dst` while `src` is owned by this function.
16361635
unsafe {
1637-
#[cfg(debug_assertions)] // Too expensive to always enable (for now?)
16381636
ub_checks::assert_unsafe_precondition!(
16391637
check_language_ub,
16401638
"ptr::write requires that the pointer argument is aligned and non-null",

0 commit comments

Comments
 (0)