about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-03-20 19:02:32 +0000
committerbors <bors@rust-lang.org>2020-03-20 19:02:32 +0000
commit1057dc97afce39ff6a224966ece3ed438af4c1f5 (patch)
tree3ae6e64d6e60e9aeac52df17f5a1cb4ba37688af /src/libcore
parent2835ca65845c5fac8da2a2612a06b12ad2f4c77c (diff)
parentc95f08affac33aa86c9c39110e7d717d2a5e3d33 (diff)
downloadrust-1057dc97afce39ff6a224966ece3ed438af4c1f5.tar.gz
rust-1057dc97afce39ff6a224966ece3ed438af4c1f5.zip
Auto merge of #69509 - RalfJung:debug-assert-write, r=eddyb
debug-assert ptr sanity in ptr::write

This is a re-submission of the parts that we removed from https://github.com/rust-lang/rust/pull/69208 due to ["interesting" test failures](https://github.com/rust-lang/rust/pull/69208#issuecomment-591310437).

Fixes https://github.com/rust-lang/rust/issues/53871
r? @Mark-Simulacrum @eddyb
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ptr/mod.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs
index 72c46f58fcc..4913cd73a2a 100644
--- a/src/libcore/ptr/mod.rs
+++ b/src/libcore/ptr/mod.rs
@@ -810,9 +810,7 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub unsafe fn write<T>(dst: *mut T, src: T) {
-    // FIXME: the debug assertion here causes codegen test failures on some architectures.
-    // See <https://github.com/rust-lang/rust/pull/69208#issuecomment-591326757>.
-    // debug_assert!(is_aligned_and_not_null(dst), "attempt to write to unaligned or null pointer");
+    debug_assert!(is_aligned_and_not_null(dst), "attempt to write to unaligned or null pointer");
     intrinsics::move_val_init(&mut *dst, src)
 }