Skip to content

Commit 6347c48

Browse files
committed
Try enabling precondition checks on ptr::{read,write}
1 parent 1a94d83 commit 6347c48

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
@@ -1387,7 +1387,6 @@ pub const unsafe fn read<T>(src: *const T) -> T {
13871387

13881388
// SAFETY: the caller must guarantee that `src` is valid for reads.
13891389
unsafe {
1390-
#[cfg(debug_assertions)] // Too expensive to always enable (for now?)
13911390
ub_checks::assert_unsafe_precondition!(
13921391
check_language_ub,
13931392
"ptr::read requires that the pointer argument is aligned and non-null",
@@ -1596,7 +1595,6 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
15961595
// `dst` cannot overlap `src` because the caller has mutable access
15971596
// to `dst` while `src` is owned by this function.
15981597
unsafe {
1599-
#[cfg(debug_assertions)] // Too expensive to always enable (for now?)
16001598
ub_checks::assert_unsafe_precondition!(
16011599
check_language_ub,
16021600
"ptr::write requires that the pointer argument is aligned and non-null",

0 commit comments

Comments
 (0)