Skip to content

Commit aadda4d

Browse files
committed
Auto merge of rust-lang#129498 - saethlin:ptr-read-write-precondition, r=<try>
Try enabling precondition checks on ptr::{read,write} The overhead here is probably too much, but let's have the measurement anyway. This will fail at least one codegen test. r? `@ghost`
2 parents 4074d49 + 0a65e30 commit aadda4d

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)