Skip to content

Commit

Permalink
Stabilize and re-export core::array
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed May 9, 2019
1 parent 3f5152e commit 028e78d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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] {
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@
#![feature(exact_size_is_empty)]
#![feature(exhaustive_patterns)]
#![feature(external_doc)]
#![feature(fixed_size_array)]
#![feature(fn_traits)]
#![feature(fnbox)]
#![feature(generator_trait)]
Expand Down Expand Up @@ -435,6 +434,8 @@ pub use core::char;
pub use core::u128;
#[stable(feature = "core_hint", since = "1.27.0")]
pub use core::hint;
#[stable(feature = "core_array", since = "1.36.0")]
pub use core::array;

pub mod f32;
pub mod f64;
Expand Down

0 comments on commit 028e78d

Please sign in to comment.