Skip to content

Stabilize more APIs for the 1.20.0 release #43373

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

Merged
merged 8 commits into from
Jul 27, 2017
Merged
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
20 changes: 0 additions & 20 deletions src/doc/unstable-book/src/language-features/compile-error.md

This file was deleted.

4 changes: 0 additions & 4 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@

#![cfg_attr(test, allow(deprecated))] // rand
#![cfg_attr(test, feature(placement_in))]
#![cfg_attr(not(test), feature(char_escape_debug))]
#![cfg_attr(not(test), feature(core_float))]
#![cfg_attr(not(test), feature(exact_size_is_empty))]
#![cfg_attr(not(test), feature(slice_rotate))]
#![cfg_attr(not(test), feature(str_checked_slicing))]
#![cfg_attr(test, feature(rand, test))]
#![cfg_attr(stage0, feature(allocator))]
#![feature(allow_internal_unstable)]
Expand All @@ -103,7 +101,6 @@
#![feature(i128_type)]
#![feature(inclusive_range)]
#![feature(lang_items)]
#![feature(manually_drop)]
#![feature(needs_allocator)]
#![feature(nonzero)]
#![feature(offset_to)]
Expand All @@ -118,7 +115,6 @@
#![feature(specialization)]
#![feature(staged_api)]
#![feature(str_internals)]
#![feature(str_mut_extras)]
#![feature(trusted_len)]
#![feature(unboxed_closures)]
#![feature(unicode)]
Expand Down
18 changes: 7 additions & 11 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl str {
}

/// Converts a mutable string slice to a mutable byte slice.
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
#[inline(always)]
pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
core_str::StrExt::as_bytes_mut(self)
Expand Down Expand Up @@ -328,14 +328,13 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_checked_slicing)]
/// let v = "🗻∈🌏";
/// assert_eq!(Some("🗻"), v.get(0..4));
/// assert!(v.get(1..).is_none());
/// assert!(v.get(..8).is_none());
/// assert!(v.get(..42).is_none());
/// ```
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
core_str::StrExt::get(self, i)
Expand All @@ -351,14 +350,13 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_checked_slicing)]
/// let mut v = String::from("🗻∈🌏");
/// assert_eq!(Some("🗻"), v.get_mut(0..4).map(|v| &*v));
/// assert!(v.get_mut(1..).is_none());
/// assert!(v.get_mut(..8).is_none());
/// assert!(v.get_mut(..42).is_none());
/// ```
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
core_str::StrExt::get_mut(self, i)
Expand All @@ -383,15 +381,14 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_checked_slicing)]
/// let v = "🗻∈🌏";
/// unsafe {
/// assert_eq!("🗻", v.get_unchecked(0..4));
/// assert_eq!("∈", v.get_unchecked(4..7));
/// assert_eq!("🌏", v.get_unchecked(7..11));
/// }
/// ```
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
core_str::StrExt::get_unchecked(self, i)
Expand All @@ -416,15 +413,14 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_checked_slicing)]
/// let mut v = String::from("🗻∈🌏");
/// unsafe {
/// assert_eq!("🗻", v.get_unchecked_mut(0..4));
/// assert_eq!("∈", v.get_unchecked_mut(4..7));
/// assert_eq!("🌏", v.get_unchecked_mut(7..11));
/// }
/// ```
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
core_str::StrExt::get_unchecked_mut(self, i)
Expand Down Expand Up @@ -1729,7 +1725,7 @@ impl str {
}

/// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
#[unstable(feature = "str_box_extras", issue = "41119")]
#[stable(feature = "str_box_extras", since = "1.20.0")]
pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
self.into()
}
Expand Down Expand Up @@ -1996,7 +1992,7 @@ impl str {

/// Converts a boxed slice of bytes to a boxed string slice without checking
/// that the string contains valid UTF-8.
#[unstable(feature = "str_box_extras", issue = "41119")]
#[stable(feature = "str_box_extras", since = "1.20.0")]
pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
mem::transmute(v)
}
2 changes: 0 additions & 2 deletions src/liballoc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
#![feature(repr_align)]
#![feature(slice_rotate)]
#![feature(splice)]
#![feature(str_checked_slicing)]
#![feature(str_escape)]
#![feature(test)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(utf8_error_error_len)]

extern crate alloc;
extern crate test;
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ pub trait CharExt {
fn escape_unicode(self) -> EscapeUnicode;
#[stable(feature = "core", since = "1.6.0")]
fn escape_default(self) -> EscapeDefault;
#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
fn escape_debug(self) -> EscapeDebug;
#[stable(feature = "core", since = "1.6.0")]
fn len_utf8(self) -> usize;
Expand Down Expand Up @@ -776,24 +776,24 @@ impl fmt::Display for EscapeDefault {
///
/// [`escape_debug`]: ../../std/primitive.char.html#method.escape_debug
/// [`char`]: ../../std/primitive.char.html
#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
#[derive(Clone, Debug)]
pub struct EscapeDebug(EscapeDefault);

#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
impl Iterator for EscapeDebug {
type Item = char;
fn next(&mut self) -> Option<char> { self.0.next() }
fn size_hint(&self) -> (usize, Option<usize>) { self.0.size_hint() }
}

#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
impl ExactSizeIterator for EscapeDebug { }

#[unstable(feature = "fused", issue = "35602")]
impl FusedIterator for EscapeDebug {}

#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
impl fmt::Display for EscapeDebug {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(&self.0, f)
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ mod builtin {
/// For more information, see the [RFC].
///
/// [RFC]: https://github.com/rust-lang/rfcs/blob/master/text/1695-add-error-macro.md
#[unstable(feature = "compile_error_macro", issue = "40872")]
#[stable(feature = "compile_error_macro", since = "1.20.0")]
#[macro_export]
#[cfg(dox)]
macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) }
Expand Down
17 changes: 7 additions & 10 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 }

Expand All @@ -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 }
Expand All @@ -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 {
Expand All @@ -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]
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
8 changes: 2 additions & 6 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_entry)]
///
/// let mut x = None;
///
/// {
Expand All @@ -685,7 +683,7 @@ impl<T> Option<T> {
/// assert_eq!(x, Some(7));
/// ```
#[inline]
#[unstable(feature = "option_entry", issue = "39288")]
#[stable(feature = "option_entry", since = "1.20.0")]
pub fn get_or_insert(&mut self, v: T) -> &mut T {
match *self {
None => *self = Some(v),
Expand All @@ -706,8 +704,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_entry)]
///
/// let mut x = None;
///
/// {
Expand All @@ -720,7 +716,7 @@ impl<T> Option<T> {
/// assert_eq!(x, Some(7));
/// ```
#[inline]
#[unstable(feature = "option_entry", issue = "39288")]
#[stable(feature = "option_entry", since = "1.20.0")]
pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T {
match *self {
None => *self = Some(f()),
Expand Down
Loading