Skip to content
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

std: Stabilize APIs for the 1.8 release #31928

Merged
merged 2 commits into from
Feb 29, 2016
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
3 changes: 0 additions & 3 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1141,15 +1141,13 @@ the list of fields entirely. Such a struct implicitly defines a constant of
its type with the same name. For example:

```
# #![feature(braced_empty_structs)]
struct Cookie;
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
```

is equivalent to

```
# #![feature(braced_empty_structs)]
struct Cookie {}
const Cookie: Cookie = Cookie {};
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
Expand Down Expand Up @@ -2385,7 +2383,6 @@ The currently implemented features of the reference compiler are:
terms of encapsulation).
* - `default_type_parameter_fallback` - Allows type parameter defaults to
influence type inference.
* - `braced_empty_structs` - Allows use of empty structs and enum variants with braces.

* - `stmt_expr_attributes` - Allows attributes on expressions and
non-item statements.
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(custom_attribute)]
#![feature(drop_in_place)]
#![feature(dropck_parametricity)]
#![feature(fundamental)]
#![feature(lang_items)]
Expand Down
1 change: 0 additions & 1 deletion src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(drop_in_place)]
#![feature(heap_api)]
#![feature(raw)]
#![feature(heap_api)]
Expand Down
1 change: 0 additions & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#![feature(box_syntax)]
#![feature(core_intrinsics)]
#![feature(decode_utf16)]
#![feature(drop_in_place)]
#![feature(dropck_parametricity)]
#![feature(fmt_internals)]
#![feature(fmt_radix)]
Expand Down
19 changes: 16 additions & 3 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,22 @@ impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
}
}

/// Deprecated, renamed to EncodeUtf16
#[unstable(feature = "str_utf16", issue = "27714")]
#[rustc_deprecated(since = "1.8.0", reason = "renamed to EncodeUtf16")]
pub type Utf16Units<'a> = EncodeUtf16<'a>;

/// External iterator for a string's UTF-16 code units.
///
/// For use with the `std::iter` module.
#[derive(Clone)]
#[unstable(feature = "str_utf16", issue = "27714")]
pub struct Utf16Units<'a> {
#[stable(feature = "encode_utf16", since = "1.8.0")]
pub struct EncodeUtf16<'a> {
encoder: Utf16Encoder<Chars<'a>>,
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Utf16Units<'a> {
impl<'a> Iterator for EncodeUtf16<'a> {
type Item = u16;

#[inline]
Expand Down Expand Up @@ -853,10 +858,18 @@ impl str {
#[unstable(feature = "str_utf16",
reason = "this functionality may only be provided by libunicode",
issue = "27714")]
#[rustc_deprecated(since = "1.8.0", reason = "renamed to encode_utf16")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, this is another one of those cases where we don't really want the deprecation to go into effect on nightly until 1.8 is actually on the stable channel. This is probably used rarely enough that it doesn't matter, but we really need to get our story straight there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that just for deprecating stable APIs? For deprecating unstable APIs everyone should be able to immediately switch, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah, I make this mistake every time. Ignore me.

#[allow(deprecated)]
pub fn utf16_units(&self) -> Utf16Units {
Utf16Units { encoder: Utf16Encoder::new(self[..].chars()) }
}

/// Returns an iterator of `u16` over the string encoded as UTF-16.
#[stable(feature = "encode_utf16", since = "1.8.0")]
pub fn encode_utf16(&self) -> EncodeUtf16 {
EncodeUtf16 { encoder: Utf16Encoder::new(self[..].chars()) }
}

/// Returns `true` if the given pattern matches a sub-slice of
/// this string slice.
///
Expand Down
1 change: 0 additions & 1 deletion src/libcollectionstest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#![feature(step_by)]
#![feature(str_char)]
#![feature(str_escape)]
#![feature(str_utf16)]
#![feature(test)]
#![feature(unboxed_closures)]
#![feature(unicode)]
Expand Down
4 changes: 2 additions & 2 deletions src/libcollectionstest/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn test_from_utf16() {

for p in &pairs {
let (s, u) = (*p).clone();
let s_as_utf16 = s.utf16_units().collect::<Vec<u16>>();
let s_as_utf16 = s.encode_utf16().collect::<Vec<u16>>();
let u_as_string = String::from_utf16(&u).unwrap();

assert!(::rustc_unicode::str::is_utf16(&u));
Expand All @@ -150,7 +150,7 @@ fn test_from_utf16() {
assert_eq!(String::from_utf16_lossy(&u), s);

assert_eq!(String::from_utf16(&s_as_utf16).unwrap(), s);
assert_eq!(u_as_string.utf16_units().collect::<Vec<u16>>(), u);
assert_eq!(u_as_string.encode_utf16().collect::<Vec<u16>>(), u);
}
}

Expand Down
11 changes: 4 additions & 7 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,17 +579,14 @@ impl<'b, T: ?Sized> Ref<'b, T> {
/// # Example
///
/// ```
/// #![feature(cell_extras)]
///
/// use std::cell::{RefCell, Ref};
///
/// let c = RefCell::new((5, 'b'));
/// let b1: Ref<(u32, char)> = c.borrow();
/// let b2: Ref<u32> = Ref::map(b1, |t| &t.0);
/// assert_eq!(*b2, 5)
/// ```
#[unstable(feature = "cell_extras", reason = "recently added",
issue = "27746")]
#[stable(feature = "cell_map", since = "1.8.0")]
#[inline]
pub fn map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Ref<'b, U>
where F: FnOnce(&T) -> &U
Expand Down Expand Up @@ -622,6 +619,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
/// ```
#[unstable(feature = "cell_extras", reason = "recently added",
issue = "27746")]
#[rustc_deprecated(since = "1.8.0", reason = "can be built on Ref::map")]
#[inline]
pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Option<Ref<'b, U>>
where F: FnOnce(&T) -> Option<&U>
Expand All @@ -646,7 +644,6 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
/// # Example
///
/// ```
/// # #![feature(cell_extras)]
/// use std::cell::{RefCell, RefMut};
///
/// let c = RefCell::new((5, 'b'));
Expand All @@ -658,8 +655,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
/// }
/// assert_eq!(*c.borrow(), (42, 'b'));
/// ```
#[unstable(feature = "cell_extras", reason = "recently added",
issue = "27746")]
#[stable(feature = "cell_map", since = "1.8.0")]
#[inline]
pub fn map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U>
where F: FnOnce(&mut T) -> &mut U
Expand Down Expand Up @@ -698,6 +694,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
/// ```
#[unstable(feature = "cell_extras", reason = "recently added",
issue = "27746")]
#[rustc_deprecated(since = "1.8.0", reason = "can be built on RefMut::map")]
#[inline]
pub fn filter_map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> Option<RefMut<'b, U>>
where F: FnOnce(&mut T) -> Option<&mut U>
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ extern "rust-intrinsic" {
///
/// This has all the same safety problems as `ptr::read` with respect to
/// invalid pointers, types, and double drops.
#[unstable(feature = "drop_in_place", reason = "just exposed, needs FCP", issue = "27908")]
#[stable(feature = "drop_in_place", since = "1.8.0")]
pub fn drop_in_place<T: ?Sized>(to_drop: *mut T);

/// Gets a static string slice containing the name of a type.
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/num/wrapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ macro_rules! wrapping_impl {
}
}

#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")]
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl AddAssign for Wrapping<$t> {
#[inline(always)]
fn add_assign(&mut self, other: Wrapping<$t>) {
Expand All @@ -174,7 +174,7 @@ macro_rules! wrapping_impl {
}
}

#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")]
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl SubAssign for Wrapping<$t> {
#[inline(always)]
fn sub_assign(&mut self, other: Wrapping<$t>) {
Expand All @@ -192,7 +192,7 @@ macro_rules! wrapping_impl {
}
}

#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")]
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl MulAssign for Wrapping<$t> {
#[inline(always)]
fn mul_assign(&mut self, other: Wrapping<$t>) {
Expand All @@ -210,7 +210,7 @@ macro_rules! wrapping_impl {
}
}

#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")]
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl DivAssign for Wrapping<$t> {
#[inline(always)]
fn div_assign(&mut self, other: Wrapping<$t>) {
Expand All @@ -228,7 +228,7 @@ macro_rules! wrapping_impl {
}
}

#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")]
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl RemAssign for Wrapping<$t> {
#[inline(always)]
fn rem_assign(&mut self, other: Wrapping<$t>) {
Expand Down Expand Up @@ -256,7 +256,7 @@ macro_rules! wrapping_impl {
}
}

#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")]
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl BitXorAssign for Wrapping<$t> {
#[inline(always)]
fn bitxor_assign(&mut self, other: Wrapping<$t>) {
Expand All @@ -274,7 +274,7 @@ macro_rules! wrapping_impl {
}
}

#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")]
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl BitOrAssign for Wrapping<$t> {
#[inline(always)]
fn bitor_assign(&mut self, other: Wrapping<$t>) {
Expand All @@ -292,7 +292,7 @@ macro_rules! wrapping_impl {
}
}

#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")]
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl BitAndAssign for Wrapping<$t> {
#[inline(always)]
fn bitand_assign(&mut self, other: Wrapping<$t>) {
Expand Down
Loading