about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2019-02-16 00:56:00 +0800
committerkennytm <kennytm@gmail.com>2019-02-16 14:11:55 +0800
commit9a2437c0dc1f88eac3ca4c57ca005b2386a30a29 (patch)
tree161f1a449cc0ca20c675d4318798f9b5f505c57c /src/liballoc
parent762b988a0a7740d6a9b5f99932036a4ae03dd6cb (diff)
parent95ef9b4fc28ad2f5db078eb1ae233fd5be76806b (diff)
downloadrust-9a2437c0dc1f88eac3ca4c57ca005b2386a30a29.tar.gz
rust-9a2437c0dc1f88eac3ca4c57ca005b2386a30a29.zip
Rollup merge of #58468 - RalfJung:maybe-uninit-split, r=Centril
split MaybeUninit into several features, expand docs a bit

This splits the `maybe_uninit` feature gate into several:

* `maybe_uninit` for what we will hopefully stabilize soon-ish.
* `maybe_uninit_ref` for creating references into `MaybeUninit`, for which the rules are not yet clear.
* `maybe_uninit_slice` for handling slices of `MaybeUninit`, which needs more API design work.
* `maybe_uninit_array` for creating arrays of `MaybeUninit` using a macro (because we don't have https://github.com/rust-lang/rust/issues/49147 yet).

Is that an okay thing to do? The goal is to help people avoid APIs we do not want to stabilize yet. I used this to make sure rustc itself does not use `get_ref` and `get_mut`.

I also extended the docs to advise against uninitialized integers -- again this is something for which the rules are still being discussed.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/collections/btree/node.rs4
-rw-r--r--src/liballoc/lib.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs
index eb0667228d1..fc1c1878924 100644
--- a/src/liballoc/collections/btree/node.rs
+++ b/src/liballoc/collections/btree/node.rs
@@ -453,7 +453,7 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
                     root: self.root,
                     _marker: PhantomData
                 },
-                idx: unsafe { usize::from(*self.as_header().parent_idx.get_ref()) },
+                idx: unsafe { usize::from(*self.as_header().parent_idx.as_ptr()) },
                 _marker: PhantomData
             })
         } else {
@@ -1143,7 +1143,7 @@ impl<BorrowType, K, V>
         NodeRef {
             height: self.node.height - 1,
             node: unsafe {
-                self.node.as_internal().edges.get_unchecked(self.idx).get_ref().as_ptr()
+                (&*self.node.as_internal().edges.get_unchecked(self.idx).as_ptr()).as_ptr()
             },
             root: self.node.root,
             _marker: PhantomData
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 95b9dacf856..440ce8ac5e8 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -112,7 +112,7 @@
 #![feature(rustc_const_unstable)]
 #![feature(const_vec_new)]
 #![feature(slice_partition_dedup)]
-#![feature(maybe_uninit)]
+#![feature(maybe_uninit, maybe_uninit_slice, maybe_uninit_array)]
 #![feature(alloc_layout_extra)]
 #![feature(try_trait)]