about summary refs log tree commit diff
path: root/src/liballoc/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-10-19 05:11:13 +0000
committerbors <bors@rust-lang.org>2019-10-19 05:11:13 +0000
commit9578272d681c8691ca2ff3f5c4230b491bc1c694 (patch)
treee79b95fd297e775f68d88839f20dd8c3dfe67ed8 /src/liballoc/tests
parent14f0ed64e306cfc232c3209985afb53fa2cadbb2 (diff)
parent3e1da91349abe9e6f793f246186915b6192e2011 (diff)
downloadrust-9578272d681c8691ca2ff3f5c4230b491bc1c694.tar.gz
rust-9578272d681c8691ca2ff3f5c4230b491bc1c694.zip
Auto merge of #65588 - Centril:rollup-9k55k3t, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #65174 (Fix zero-size uninitialized boxes)
 - #65252 (expand: Simplify expansion of derives)
 - #65485 (Suppress ICE when validators disagree on `LiveDrop`s in presence of `&mut`)
 - #65542 (Refer to "associated functions" instead of "static methods")
 - #65545 (More symbol cleanups)
 - #65576 (Don't add `argc` and `argv` arguments to `main` on WASI.)

Failed merges:

r? @ghost
Diffstat (limited to 'src/liballoc/tests')
-rw-r--r--src/liballoc/tests/boxed.rs18
-rw-r--r--src/liballoc/tests/lib.rs2
2 files changed, 20 insertions, 0 deletions
diff --git a/src/liballoc/tests/boxed.rs b/src/liballoc/tests/boxed.rs
new file mode 100644
index 00000000000..bc3d53bf30d
--- /dev/null
+++ b/src/liballoc/tests/boxed.rs
@@ -0,0 +1,18 @@
+use std::ptr::NonNull;
+use std::mem::MaybeUninit;
+
+#[test]
+fn unitialized_zero_size_box() {
+    assert_eq!(
+        &*Box::<()>::new_uninit() as *const _,
+        NonNull::<MaybeUninit<()>>::dangling().as_ptr(),
+    );
+    assert_eq!(
+        Box::<[()]>::new_uninit_slice(4).as_ptr(),
+        NonNull::<MaybeUninit<()>>::dangling().as_ptr(),
+    );
+    assert_eq!(
+        Box::<[String]>::new_uninit_slice(0).as_ptr(),
+        NonNull::<MaybeUninit<String>>::dangling().as_ptr(),
+    );
+}
diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs
index f2a2c80f2f7..676874c8b27 100644
--- a/src/liballoc/tests/lib.rs
+++ b/src/liballoc/tests/lib.rs
@@ -2,6 +2,7 @@
 #![feature(box_syntax)]
 #![feature(drain_filter)]
 #![feature(exact_size_is_empty)]
+#![feature(new_uninit)]
 #![feature(option_flattening)]
 #![feature(pattern)]
 #![feature(trusted_len)]
@@ -14,6 +15,7 @@ use std::collections::hash_map::DefaultHasher;
 
 mod arc;
 mod binary_heap;
+mod boxed;
 mod btree;
 mod cow_str;
 mod fmt;