std: Stabilize manually_drop feature

Stabilizes

* `core::mem::ManuallyDrop`
* `std::mem::ManuallyDrop`
* `ManuallyDrop::new`
* `ManuallyDrop::into_inner`
* `ManuallyDrop::drop`
* `Deref for ManuallyDrop`
* `DerefMut for ManuallyDrop`

Closes #40673
This commit is contained in:
Alex Crichton 2017-07-20 15:48:15 -07:00
parent 3fae48107f
commit daeb6077c8
3 changed files with 7 additions and 12 deletions

View File

@ -101,7 +101,6 @@
#![feature(i128_type)] #![feature(i128_type)]
#![feature(inclusive_range)] #![feature(inclusive_range)]
#![feature(lang_items)] #![feature(lang_items)]
#![feature(manually_drop)]
#![feature(needs_allocator)] #![feature(needs_allocator)]
#![feature(nonzero)] #![feature(nonzero)]
#![feature(offset_to)] #![feature(offset_to)]

View File

@ -838,7 +838,6 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
/// the type: /// the type:
/// ///
/// ```rust /// ```rust
/// # #![feature(manually_drop)]
/// use std::mem::ManuallyDrop; /// use std::mem::ManuallyDrop;
/// struct Peach; /// struct Peach;
/// struct Banana; /// struct Banana;
@ -864,7 +863,7 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
/// } /// }
/// } /// }
/// ``` /// ```
#[unstable(feature = "manually_drop", issue = "40673")] #[stable(feature = "manually_drop", since = "1.20.0")]
#[allow(unions_with_drop_fields)] #[allow(unions_with_drop_fields)]
pub union ManuallyDrop<T>{ value: T } pub union ManuallyDrop<T>{ value: T }
@ -874,11 +873,10 @@ impl<T> ManuallyDrop<T> {
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// # #![feature(manually_drop)]
/// use std::mem::ManuallyDrop; /// use std::mem::ManuallyDrop;
/// ManuallyDrop::new(Box::new(())); /// ManuallyDrop::new(Box::new(()));
/// ``` /// ```
#[unstable(feature = "manually_drop", issue = "40673")] #[stable(feature = "manually_drop", since = "1.20.0")]
#[inline] #[inline]
pub fn new(value: T) -> ManuallyDrop<T> { pub fn new(value: T) -> ManuallyDrop<T> {
ManuallyDrop { value: value } ManuallyDrop { value: value }
@ -889,12 +887,11 @@ impl<T> ManuallyDrop<T> {
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// # #![feature(manually_drop)]
/// use std::mem::ManuallyDrop; /// use std::mem::ManuallyDrop;
/// let x = ManuallyDrop::new(Box::new(())); /// let x = ManuallyDrop::new(Box::new(()));
/// let _: Box<()> = ManuallyDrop::into_inner(x); /// let _: Box<()> = ManuallyDrop::into_inner(x);
/// ``` /// ```
#[unstable(feature = "manually_drop", issue = "40673")] #[stable(feature = "manually_drop", since = "1.20.0")]
#[inline] #[inline]
pub fn into_inner(slot: ManuallyDrop<T>) -> T { pub fn into_inner(slot: ManuallyDrop<T>) -> T {
unsafe { unsafe {
@ -909,14 +906,14 @@ impl<T> ManuallyDrop<T> {
/// This function runs the destructor of the contained value and thus the wrapped value /// This function runs the destructor of the contained value and thus the wrapped value
/// now represents uninitialized data. It is up to the user of this method to ensure the /// now represents uninitialized data. It is up to the user of this method to ensure the
/// uninitialized data is not actually used. /// uninitialized data is not actually used.
#[unstable(feature = "manually_drop", issue = "40673")] #[stable(feature = "manually_drop", since = "1.20.0")]
#[inline] #[inline]
pub unsafe fn drop(slot: &mut ManuallyDrop<T>) { pub unsafe fn drop(slot: &mut ManuallyDrop<T>) {
ptr::drop_in_place(&mut slot.value) ptr::drop_in_place(&mut slot.value)
} }
} }
#[unstable(feature = "manually_drop", issue = "40673")] #[stable(feature = "manually_drop", since = "1.20.0")]
impl<T> ::ops::Deref for ManuallyDrop<T> { impl<T> ::ops::Deref for ManuallyDrop<T> {
type Target = T; type Target = T;
#[inline] #[inline]
@ -927,7 +924,7 @@ impl<T> ::ops::Deref for ManuallyDrop<T> {
} }
} }
#[unstable(feature = "manually_drop", issue = "40673")] #[stable(feature = "manually_drop", since = "1.20.0")]
impl<T> ::ops::DerefMut for ManuallyDrop<T> { impl<T> ::ops::DerefMut for ManuallyDrop<T> {
#[inline] #[inline]
fn deref_mut(&mut self) -> &mut Self::Target { fn deref_mut(&mut self) -> &mut Self::Target {
@ -937,7 +934,7 @@ impl<T> ::ops::DerefMut for ManuallyDrop<T> {
} }
} }
#[unstable(feature = "manually_drop", issue = "40673")] #[stable(feature = "manually_drop", since = "1.20.0")]
impl<T: ::fmt::Debug> ::fmt::Debug for ManuallyDrop<T> { impl<T: ::fmt::Debug> ::fmt::Debug for ManuallyDrop<T> {
fn fmt(&self, fmt: &mut ::fmt::Formatter) -> ::fmt::Result { fn fmt(&self, fmt: &mut ::fmt::Formatter) -> ::fmt::Result {
unsafe { unsafe {

View File

@ -34,7 +34,6 @@
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(discriminant_value)] #![feature(discriminant_value)]
#![feature(specialization)] #![feature(specialization)]
#![feature(manually_drop)]
#![cfg_attr(stage0, feature(associated_consts))] #![cfg_attr(stage0, feature(associated_consts))]
#![cfg_attr(stage0, feature(struct_field_attributes))] #![cfg_attr(stage0, feature(struct_field_attributes))]