about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-09 18:43:00 +0000
committerbors <bors@rust-lang.org>2019-05-09 18:43:00 +0000
commita784a80228c9eac3aa0fd86fc90887d5fa20c82e (patch)
tree9e3f055ea50be9a3ef2bbad5dd7d1f3e18bfea2e /src/libcore
parentef01f29964df207f181bd5bcf236e41372a17273 (diff)
parente40f9a62bb5445767b563d888bcbfc4cd4416d38 (diff)
downloadrust-a784a80228c9eac3aa0fd86fc90887d5fa20c82e.tar.gz
rust-a784a80228c9eac3aa0fd86fc90887d5fa20c82e.zip
Auto merge of #60672 - Centril:rollup-fhcx463, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #60601 (Add a `cast` method to raw pointers.)
 - #60638 (pin: make the to-module link more visible)
 - #60647 (cleanup: Remove `DefIndexAddressSpace`)
 - #60656 (Inline some Cursor calls for slices)
 - #60657 (Stabilize and re-export core::array in std)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/array.rs10
-rw-r--r--src/libcore/pin.rs2
-rw-r--r--src/libcore/ptr.rs14
3 files changed, 21 insertions, 5 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index fb9c99f667d..e4cadcbf75b 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -4,10 +4,7 @@
 //!
 //! *[See also the array primitive type](../../std/primitive.array.html).*
 
-#![unstable(feature = "fixed_size_array",
-            reason = "traits and impls are better expressed through generic \
-                      integer constants",
-            issue = "27778")]
+#![stable(feature = "core_array", since = "1.36.0")]
 
 use crate::borrow::{Borrow, BorrowMut};
 use crate::cmp::Ordering;
@@ -30,13 +27,17 @@ use crate::slice::{Iter, IterMut};
 /// Note that the traits AsRef and AsMut provide similar methods for types that
 /// may not be fixed-size arrays. Implementors should prefer those traits
 /// instead.
+#[unstable(feature = "fixed_size_array", issue = "27778")]
 pub unsafe trait FixedSizeArray<T> {
     /// Converts the array to immutable slice
+    #[unstable(feature = "fixed_size_array", issue = "27778")]
     fn as_slice(&self) -> &[T];
     /// Converts the array to mutable slice
+    #[unstable(feature = "fixed_size_array", issue = "27778")]
     fn as_mut_slice(&mut self) -> &mut [T];
 }
 
+#[unstable(feature = "fixed_size_array", issue = "27778")]
 unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
     #[inline]
     fn as_slice(&self) -> &[T] {
@@ -53,6 +54,7 @@ unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
 #[derive(Debug, Copy, Clone)]
 pub struct TryFromSliceError(());
 
+#[stable(feature = "core_array", since = "1.36.0")]
 impl fmt::Display for TryFromSliceError {
     #[inline]
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs
index e74ed9b7889..4ced860948b 100644
--- a/src/libcore/pin.rs
+++ b/src/libcore/pin.rs
@@ -274,7 +274,7 @@ use crate::ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn};
 /// value in place, preventing the value referenced by that pointer from being moved
 /// unless it implements [`Unpin`].
 ///
-/// See the [`pin` module] documentation for further explanation on pinning.
+/// *See the [`pin` module] documentation for an explanation of pinning.*
 ///
 /// [`Unpin`]: ../../std/marker/trait.Unpin.html
 /// [`pin` module]: ../../std/pin/index.html
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index a41be4269d5..6355bcdcab2 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -974,6 +974,13 @@ impl<T: ?Sized> *const T {
         (self as *const u8) == null()
     }
 
+    /// Cast to a pointer to a different type
+    #[unstable(feature = "ptr_cast", issue = "60602")]
+    #[inline]
+    pub const fn cast<U>(self) -> *const U {
+        self as _
+    }
+
     /// Returns `None` if the pointer is null, or else returns a reference to
     /// the value wrapped in `Some`.
     ///
@@ -1593,6 +1600,13 @@ impl<T: ?Sized> *mut T {
         (self as *mut u8) == null_mut()
     }
 
+    /// Cast to a pointer to a different type
+    #[unstable(feature = "ptr_cast", issue = "60602")]
+    #[inline]
+    pub const fn cast<U>(self) -> *mut U {
+        self as _
+    }
+
     /// Returns `None` if the pointer is null, or else returns a reference to
     /// the value wrapped in `Some`.
     ///