We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2986cc0 commit f9b6f51Copy full SHA for f9b6f51
library/core/src/ptr/mod.rs
@@ -1426,6 +1426,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
1426
1427
// SAFETY: the caller must guarantee that `src` is valid for reads.
1428
unsafe {
1429
+ #[cfg(debug_assertions)]
1430
ub_checks::assert_unsafe_precondition!(
1431
check_language_ub,
1432
"ptr::read requires that the pointer argument is aligned and non-null",
@@ -1634,7 +1635,6 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
1634
1635
// `dst` cannot overlap `src` because the caller has mutable access
1636
// to `dst` while `src` is owned by this function.
1637
- #[cfg(debug_assertions)]
1638
1639
1640
"ptr::write requires that the pointer argument is aligned and non-null",
0 commit comments