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:
parent
3fae48107f
commit
daeb6077c8
@ -101,7 +101,6 @@
|
||||
#![feature(i128_type)]
|
||||
#![feature(inclusive_range)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(manually_drop)]
|
||||
#![feature(needs_allocator)]
|
||||
#![feature(nonzero)]
|
||||
#![feature(offset_to)]
|
||||
|
@ -838,7 +838,6 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
|
||||
/// the type:
|
||||
///
|
||||
/// ```rust
|
||||
/// # #![feature(manually_drop)]
|
||||
/// use std::mem::ManuallyDrop;
|
||||
/// struct Peach;
|
||||
/// 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)]
|
||||
pub union ManuallyDrop<T>{ value: T }
|
||||
|
||||
@ -874,11 +873,10 @@ impl<T> ManuallyDrop<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// # #![feature(manually_drop)]
|
||||
/// use std::mem::ManuallyDrop;
|
||||
/// ManuallyDrop::new(Box::new(()));
|
||||
/// ```
|
||||
#[unstable(feature = "manually_drop", issue = "40673")]
|
||||
#[stable(feature = "manually_drop", since = "1.20.0")]
|
||||
#[inline]
|
||||
pub fn new(value: T) -> ManuallyDrop<T> {
|
||||
ManuallyDrop { value: value }
|
||||
@ -889,12 +887,11 @@ impl<T> ManuallyDrop<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// # #![feature(manually_drop)]
|
||||
/// use std::mem::ManuallyDrop;
|
||||
/// let x = ManuallyDrop::new(Box::new(()));
|
||||
/// let _: Box<()> = ManuallyDrop::into_inner(x);
|
||||
/// ```
|
||||
#[unstable(feature = "manually_drop", issue = "40673")]
|
||||
#[stable(feature = "manually_drop", since = "1.20.0")]
|
||||
#[inline]
|
||||
pub fn into_inner(slot: ManuallyDrop<T>) -> T {
|
||||
unsafe {
|
||||
@ -909,14 +906,14 @@ impl<T> ManuallyDrop<T> {
|
||||
/// 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
|
||||
/// uninitialized data is not actually used.
|
||||
#[unstable(feature = "manually_drop", issue = "40673")]
|
||||
#[stable(feature = "manually_drop", since = "1.20.0")]
|
||||
#[inline]
|
||||
pub unsafe fn drop(slot: &mut ManuallyDrop<T>) {
|
||||
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> {
|
||||
type Target = T;
|
||||
#[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> {
|
||||
#[inline]
|
||||
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> {
|
||||
fn fmt(&self, fmt: &mut ::fmt::Formatter) -> ::fmt::Result {
|
||||
unsafe {
|
||||
|
@ -34,7 +34,6 @@
|
||||
#![feature(conservative_impl_trait)]
|
||||
#![feature(discriminant_value)]
|
||||
#![feature(specialization)]
|
||||
#![feature(manually_drop)]
|
||||
|
||||
#![cfg_attr(stage0, feature(associated_consts))]
|
||||
#![cfg_attr(stage0, feature(struct_field_attributes))]
|
||||
|
Loading…
Reference in New Issue
Block a user