Skip to content

Stabilize as_array_of_cells #144054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,14 +698,14 @@ impl<T, const N: usize> Cell<[T; N]> {
/// # Examples
///
/// ```
/// #![feature(as_array_of_cells)]
/// use std::cell::Cell;
///
/// let mut array: [i32; 3] = [1, 2, 3];
/// let cell_array: &Cell<[i32; 3]> = Cell::from_mut(&mut array);
/// let array_cell: &[Cell<i32>; 3] = cell_array.as_array_of_cells();
/// ```
#[unstable(feature = "as_array_of_cells", issue = "88248")]
#[stable(feature = "as_array_of_cells", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "as_array_of_cells", since = "CURRENT_RUSTC_VERSION")]
pub const fn as_array_of_cells(&self) -> &[Cell<T>; N] {
// SAFETY: `Cell<T>` has the same memory layout as `T`.
unsafe { &*(self as *const Cell<[T; N]> as *const [Cell<T>; N]) }
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/rfcs/rfc-1789-as-cell/from-mut.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//@ run-pass

#![feature(as_array_of_cells)]

use std::cell::Cell;

fn main() {
Expand Down
Loading