Auto merge of #61620 - SimonSapin:as_cell, r=RalfJung
Stabilize Cell::from_mut and as_slice_of_cells FCP: https://github.com/rust-lang/rust/issues/43038#issuecomment-499900463
This commit is contained in:
commit
fb7cca33f8
2 changed files with 2 additions and 5 deletions
|
@ -494,7 +494,6 @@ impl<T: ?Sized> Cell<T> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(as_cell)]
|
||||
/// use std::cell::Cell;
|
||||
///
|
||||
/// let slice: &mut [i32] = &mut [1, 2, 3];
|
||||
|
@ -504,7 +503,7 @@ impl<T: ?Sized> Cell<T> {
|
|||
/// assert_eq!(slice_cell.len(), 3);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "as_cell", issue="43038")]
|
||||
#[stable(feature = "as_cell", since = "1.37.0")]
|
||||
pub fn from_mut(t: &mut T) -> &Cell<T> {
|
||||
unsafe {
|
||||
&*(t as *mut T as *const Cell<T>)
|
||||
|
@ -541,7 +540,6 @@ impl<T> Cell<[T]> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(as_cell)]
|
||||
/// use std::cell::Cell;
|
||||
///
|
||||
/// let slice: &mut [i32] = &mut [1, 2, 3];
|
||||
|
@ -550,7 +548,7 @@ impl<T> Cell<[T]> {
|
|||
///
|
||||
/// assert_eq!(slice_cell.len(), 3);
|
||||
/// ```
|
||||
#[unstable(feature = "as_cell", issue="43038")]
|
||||
#[stable(feature = "as_cell", since = "1.37.0")]
|
||||
pub fn as_slice_of_cells(&self) -> &[Cell<T>] {
|
||||
unsafe {
|
||||
&*(self as *const Cell<[T]> as *const [Cell<T>])
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(as_cell)]
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
|
Loading…
Reference in a new issue