diff --git a/src/doc/reference.md b/src/doc/reference.md index c2d1fedf6d243..6fb8de780942c 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1141,7 +1141,6 @@ 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 {}]; ``` @@ -1149,7 +1148,6 @@ 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 {}]; @@ -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. diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 1d928a922c7e0..300142d5ec18e 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -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)] diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 46a63390c8352..cb1107fb650e1 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -31,7 +31,6 @@ #![feature(alloc)] #![feature(core_intrinsics)] -#![feature(drop_in_place)] #![feature(heap_api)] #![feature(raw)] #![feature(heap_api)] diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 9c6fdc217dc42..373fe7dc4c139 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -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)] diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 5f3df398f16ba..a30ec452e3c15 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -112,17 +112,22 @@ impl> SliceConcatExt 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>, } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Iterator for Utf16Units<'a> { +impl<'a> Iterator for EncodeUtf16<'a> { type Item = u16; #[inline] @@ -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")] + #[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. /// diff --git a/src/libcollectionstest/lib.rs b/src/libcollectionstest/lib.rs index bf76d0b847caa..eed530d8b61cd 100644 --- a/src/libcollectionstest/lib.rs +++ b/src/libcollectionstest/lib.rs @@ -29,7 +29,6 @@ #![feature(step_by)] #![feature(str_char)] #![feature(str_escape)] -#![feature(str_utf16)] #![feature(test)] #![feature(unboxed_closures)] #![feature(unicode)] diff --git a/src/libcollectionstest/string.rs b/src/libcollectionstest/string.rs index 158145af2bbef..d8e01f3800caf 100644 --- a/src/libcollectionstest/string.rs +++ b/src/libcollectionstest/string.rs @@ -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::>(); + let s_as_utf16 = s.encode_utf16().collect::>(); let u_as_string = String::from_utf16(&u).unwrap(); assert!(::rustc_unicode::str::is_utf16(&u)); @@ -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::>(), u); + assert_eq!(u_as_string.encode_utf16().collect::>(), u); } } diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 6041355e9dbc0..255c846244bdc 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -579,8 +579,6 @@ impl<'b, T: ?Sized> Ref<'b, T> { /// # Example /// /// ``` - /// #![feature(cell_extras)] - /// /// use std::cell::{RefCell, Ref}; /// /// let c = RefCell::new((5, 'b')); @@ -588,8 +586,7 @@ impl<'b, T: ?Sized> Ref<'b, T> { /// let b2: Ref = 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(orig: Ref<'b, T>, f: F) -> Ref<'b, U> where F: FnOnce(&T) -> &U @@ -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(orig: Ref<'b, T>, f: F) -> Option> where F: FnOnce(&T) -> Option<&U> @@ -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')); @@ -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(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U> where F: FnOnce(&mut T) -> &mut U @@ -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(orig: RefMut<'b, T>, f: F) -> Option> where F: FnOnce(&mut T) -> Option<&mut U> diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index b0dcb0d539989..0417ef84163ab 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -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(to_drop: *mut T); /// Gets a static string slice containing the name of a type. diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index a6b3dc744699a..7ccc15c21121b 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -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>) { @@ -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>) { @@ -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>) { @@ -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>) { @@ -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>) { @@ -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>) { @@ -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>) { @@ -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>) { diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index d1c5b175bb034..0f5584a952f54 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -891,9 +891,6 @@ shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize } /// calling `add_assign`, and therefore, `main` prints `Adding!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::AddAssign; /// /// struct Foo; @@ -911,15 +908,16 @@ shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize } /// } /// ``` #[lang = "add_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait AddAssign { /// The method for the `+=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn add_assign(&mut self, Rhs); } macro_rules! add_assign_impl { ($($t:ty)+) => ($( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl AddAssign for $t { #[inline] fn add_assign(&mut self, other: $t) { *self += other } @@ -937,9 +935,6 @@ add_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// calling `sub_assign`, and therefore, `main` prints `Subtracting!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::SubAssign; /// /// struct Foo; @@ -957,15 +952,16 @@ add_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang = "sub_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait SubAssign { /// The method for the `-=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn sub_assign(&mut self, Rhs); } macro_rules! sub_assign_impl { ($($t:ty)+) => ($( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl SubAssign for $t { #[inline] fn sub_assign(&mut self, other: $t) { *self -= other } @@ -983,9 +979,6 @@ sub_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// calling `mul_assign`, and therefore, `main` prints `Multiplying!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::MulAssign; /// /// struct Foo; @@ -1003,15 +996,16 @@ sub_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang = "mul_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait MulAssign { /// The method for the `*=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn mul_assign(&mut self, Rhs); } macro_rules! mul_assign_impl { ($($t:ty)+) => ($( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl MulAssign for $t { #[inline] fn mul_assign(&mut self, other: $t) { *self *= other } @@ -1029,9 +1023,6 @@ mul_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// calling `div_assign`, and therefore, `main` prints `Dividing!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::DivAssign; /// /// struct Foo; @@ -1049,15 +1040,16 @@ mul_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang = "div_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait DivAssign { /// The method for the `/=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn div_assign(&mut self, Rhs); } macro_rules! div_assign_impl { ($($t:ty)+) => ($( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl DivAssign for $t { #[inline] fn div_assign(&mut self, other: $t) { *self /= other } @@ -1075,9 +1067,6 @@ div_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// calling `rem_assign`, and therefore, `main` prints `Remainder-ing!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::RemAssign; /// /// struct Foo; @@ -1095,15 +1084,16 @@ div_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang = "rem_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait RemAssign { /// The method for the `%=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn rem_assign(&mut self, Rhs); } macro_rules! rem_assign_impl { ($($t:ty)+) => ($( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl RemAssign for $t { #[inline] fn rem_assign(&mut self, other: $t) { *self %= other } @@ -1121,9 +1111,6 @@ rem_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// calling `bitand_assign`, and therefore, `main` prints `Bitwise And-ing!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::BitAndAssign; /// /// struct Foo; @@ -1141,15 +1128,16 @@ rem_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang = "bitand_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait BitAndAssign { /// The method for the `&` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn bitand_assign(&mut self, Rhs); } macro_rules! bitand_assign_impl { ($($t:ty)+) => ($( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl BitAndAssign for $t { #[inline] fn bitand_assign(&mut self, other: $t) { *self &= other } @@ -1167,9 +1155,6 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 } /// calling `bitor_assign`, and therefore, `main` prints `Bitwise Or-ing!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::BitOrAssign; /// /// struct Foo; @@ -1187,15 +1172,16 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 } /// } /// ``` #[lang = "bitor_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait BitOrAssign { /// The method for the `|=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn bitor_assign(&mut self, Rhs); } macro_rules! bitor_assign_impl { ($($t:ty)+) => ($( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl BitOrAssign for $t { #[inline] fn bitor_assign(&mut self, other: $t) { *self |= other } @@ -1213,9 +1199,6 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 } /// calling `bitxor_assign`, and therefore, `main` prints `Bitwise Xor-ing!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::BitXorAssign; /// /// struct Foo; @@ -1233,15 +1216,16 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 } /// } /// ``` #[lang = "bitxor_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait BitXorAssign { /// The method for the `^=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn bitxor_assign(&mut self, Rhs); } macro_rules! bitxor_assign_impl { ($($t:ty)+) => ($( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl BitXorAssign for $t { #[inline] fn bitxor_assign(&mut self, other: $t) { *self ^= other } @@ -1259,9 +1243,6 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 } /// calling `shl_assign`, and therefore, `main` prints `Shifting left!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::ShlAssign; /// /// struct Foo; @@ -1279,15 +1260,16 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 } /// } /// ``` #[lang = "shl_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait ShlAssign { /// The method for the `<<=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn shl_assign(&mut self, Rhs); } macro_rules! shl_assign_impl { ($t:ty, $f:ty) => ( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl ShlAssign<$f> for $t { #[inline] fn shl_assign(&mut self, other: $f) { @@ -1323,9 +1305,6 @@ shl_assign_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize } /// calling `shr_assign`, and therefore, `main` prints `Shifting right!`. /// /// ``` -/// #![feature(augmented_assignments)] -/// #![feature(op_assign_traits)] -/// /// use std::ops::ShrAssign; /// /// struct Foo; @@ -1343,15 +1322,16 @@ shl_assign_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize } /// } /// ``` #[lang = "shr_assign"] -#[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] +#[stable(feature = "op_assign_traits", since = "1.8.0")] pub trait ShrAssign { /// The method for the `>>=` operator + #[stable(feature = "op_assign_traits", since = "1.8.0")] fn shr_assign(&mut self, Rhs); } macro_rules! shr_assign_impl { ($t:ty, $f:ty) => ( - #[unstable(feature = "op_assign_traits", reason = "recently added", issue = "28235")] + #[stable(feature = "op_assign_traits", since = "1.8.0")] impl ShrAssign<$f> for $t { #[inline] fn shr_assign(&mut self, other: $f) { diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index f871857dab632..cb109c010c769 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -40,7 +40,7 @@ pub use intrinsics::copy; #[stable(feature = "rust1", since = "1.0.0")] pub use intrinsics::write_bytes; -#[unstable(feature = "drop_in_place", reason = "just exposed, needs FCP", issue = "27908")] +#[stable(feature = "drop_in_place", since = "1.8.0")] pub use intrinsics::drop_in_place; /// Creates a null raw pointer. diff --git a/src/libcoretest/cell.rs b/src/libcoretest/cell.rs index 309a3d51c7602..cafffb5266f91 100644 --- a/src/libcoretest/cell.rs +++ b/src/libcoretest/cell.rs @@ -159,6 +159,7 @@ fn ref_map_accessor() { } #[test] +#[allow(deprecated)] fn ref_filter_map_accessor() { struct X(RefCell>); impl X { @@ -189,6 +190,7 @@ fn ref_mut_map_accessor() { } #[test] +#[allow(deprecated)] fn ref_mut_filter_map_accessor() { struct X(RefCell>); impl X { diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 712afd00d4686..4ff3b21dc83f4 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -26,7 +26,6 @@ #![feature(associated_consts)] #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(cell_extras)] #![feature(collections)] #![feature(const_fn)] #![feature(copy_from_slice)] @@ -37,11 +36,9 @@ #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(scoped_tls)] #![feature(slice_patterns)] #![feature(staged_api)] #![feature(str_char)] -#![feature(time2)] #![cfg_attr(test, feature(test))] extern crate arena; diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 5de192ca4ebfb..3b72685eca310 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -448,6 +448,7 @@ pub mod tls { use rbml::opaque::Encoder as OpaqueEncoder; use rbml::opaque::Decoder as OpaqueDecoder; use serialize; + use std::cell::Cell; use std::mem; use middle::ty::{self, Ty}; use middle::subst::Substs; @@ -459,12 +460,14 @@ pub mod tls { fn encode_substs(&self, encoder: &mut OpaqueEncoder, substs: &Substs<'tcx>); } - /// Marker type used for the scoped TLS slot. - /// The type context cannot be used directly because the scoped TLS + /// Marker type used for the TLS slot. + /// The type context cannot be used directly because the TLS /// in libstd doesn't allow types generic over lifetimes. struct TlsPayload; - scoped_thread_local!(static TLS_ENCODING: TlsPayload); + thread_local! { + static TLS_ENCODING: Cell> = Cell::new(None) + } /// Execute f after pushing the given EncodingContext onto the TLS stack. pub fn enter_encoding_context<'tcx, F, R>(ecx: &EncodingContext<'tcx>, @@ -474,7 +477,13 @@ pub mod tls { { let tls_payload = (ecx as *const _, encoder as *mut _); let tls_ptr = &tls_payload as *const _ as *const TlsPayload; - TLS_ENCODING.set(unsafe { &*tls_ptr }, || f(ecx, encoder)) + TLS_ENCODING.with(|tls| { + let prev = tls.get(); + tls.set(Some(tls_ptr)); + let ret = f(ecx, encoder); + tls.set(prev); + return ret + }) } /// Execute f with access to the thread-local encoding context and @@ -506,8 +515,8 @@ pub mod tls { where F: FnOnce(&EncodingContext, &mut OpaqueEncoder) -> R { TLS_ENCODING.with(|tls| { - let tls_payload = (tls as *const TlsPayload) - as *mut (&EncodingContext, &mut OpaqueEncoder); + let tls = tls.get().unwrap(); + let tls_payload = tls as *mut (&EncodingContext, &mut OpaqueEncoder); f((*tls_payload).0, (*tls_payload).1) }) } @@ -519,7 +528,9 @@ pub mod tls { fn translate_def_id(&self, def_id: DefId) -> DefId; } - scoped_thread_local!(static TLS_DECODING: TlsPayload); + thread_local! { + static TLS_DECODING: Cell> = Cell::new(None) + } /// Execute f after pushing the given DecodingContext onto the TLS stack. pub fn enter_decoding_context<'tcx, F, R>(dcx: &DecodingContext<'tcx>, @@ -529,7 +540,13 @@ pub mod tls { { let tls_payload = (dcx as *const _, decoder as *mut _); let tls_ptr = &tls_payload as *const _ as *const TlsPayload; - TLS_DECODING.set(unsafe { &*tls_ptr }, || f(dcx, decoder)) + TLS_DECODING.with(|tls| { + let prev = tls.get(); + tls.set(Some(tls_ptr)); + let ret = f(dcx, decoder); + tls.set(prev); + return ret + }) } /// Execute f with access to the thread-local decoding context and @@ -563,8 +580,8 @@ pub mod tls { where F: FnOnce(&DecodingContext, &mut OpaqueDecoder) -> R { TLS_DECODING.with(|tls| { - let tls_payload = (tls as *const TlsPayload) - as *mut (&DecodingContext, &mut OpaqueDecoder); + let tls = tls.get().unwrap(); + let tls_payload = tls as *mut (&DecodingContext, &mut OpaqueDecoder); f((*tls_payload).0, (*tls_payload).1) }) } diff --git a/src/librustc/middle/ty/context.rs b/src/librustc/middle/ty/context.rs index ea6b4df8104d5..a014c63f0a2a9 100644 --- a/src/librustc/middle/ty/context.rs +++ b/src/librustc/middle/ty/context.rs @@ -619,6 +619,7 @@ impl<'a, 'tcx> Lift<'tcx> for &'a Substs<'a> { pub mod tls { use middle::ty; + use std::cell::Cell; use std::fmt; use syntax::codemap; @@ -627,7 +628,9 @@ pub mod tls { /// in libstd doesn't allow types generic over lifetimes. struct ThreadLocalTyCx; - scoped_thread_local!(static TLS_TCX: ThreadLocalTyCx); + thread_local! { + static TLS_TCX: Cell> = Cell::new(None) + } fn span_debug(span: codemap::Span, f: &mut fmt::Formatter) -> fmt::Result { with(|tcx| { @@ -640,18 +643,27 @@ pub mod tls { let original_span_debug = span_dbg.get(); span_dbg.set(span_debug); let tls_ptr = &tcx as *const _ as *const ThreadLocalTyCx; - let result = TLS_TCX.set(unsafe { &*tls_ptr }, || f(&tcx)); + let result = TLS_TCX.with(|tls| { + let prev = tls.get(); + tls.set(Some(tls_ptr)); + let ret = f(&tcx); + tls.set(prev); + ret + }); span_dbg.set(original_span_debug); result }) } pub fn with R, R>(f: F) -> R { - TLS_TCX.with(|tcx| f(unsafe { &*(tcx as *const _ as *const ty::ctxt) })) + TLS_TCX.with(|tcx| { + let tcx = tcx.get().unwrap(); + f(unsafe { &*(tcx as *const ty::ctxt) }) + }) } pub fn with_opt) -> R, R>(f: F) -> R { - if TLS_TCX.is_set() { + if TLS_TCX.with(|tcx| tcx.get().is_some()) { with(|v| f(Some(v))) } else { f(None) diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index f416ec75010f3..5386c5b77c212 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -23,7 +23,6 @@ #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(time2)] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 7ab4975c8b8ae..7b2e678499bb8 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1418,7 +1418,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// Return the dict-like variant corresponding to a given `Def`. pub fn def_struct_variant(&self, def: Def, - span: Span) + _span: Span) -> Option<(ty::AdtDef<'tcx>, ty::VariantDef<'tcx>)> { let (adt, variant) = match def { @@ -1441,15 +1441,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if var_kind == ty::VariantKind::Struct { Some((adt, variant)) } else if var_kind == ty::VariantKind::Unit { - if !self.tcx().sess.features.borrow().braced_empty_structs { - let mut err = self.tcx().sess.struct_span_err(span, - "empty structs and enum variants \ - with braces are unstable"); - fileline_help!(&mut err, span, "add #![feature(braced_empty_structs)] to \ - the crate features to enable"); - err.emit(); - } - Some((adt, variant)) } else { None diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 9b8b6dedb6345..a28944995c48c 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -121,25 +121,6 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { }, _ => {}, } - } else { - let tcx = self.tcx(); - - if let hir::ExprAssignOp(_, ref lhs, ref rhs) = e.node { - if - !tcx.sess.features.borrow().augmented_assignments && - !self.fcx.expr_ty(e).references_error() && - !self.fcx.expr_ty(lhs).references_error() && - !self.fcx.expr_ty(rhs).references_error() - { - tcx.sess.struct_span_err(e.span, - "overloaded augmented assignments \ - are not stable") - .fileline_help(e.span, - "add #![feature(augmented_assignments)] to the \ - crate root to enable") - .emit() - } - } } } _ => {}, diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 0c8ad5abe6f8e..0835762c4e5c5 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -81,7 +81,6 @@ This API is completely unstable and subject to change. #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(cell_extras)] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index f9e7c1fede24e..e062f9040afc4 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -226,7 +226,6 @@ #![feature(core_float)] #![feature(core_intrinsics)] #![feature(decode_utf16)] -#![feature(drop_in_place)] #![feature(dropck_parametricity)] #![feature(float_extras)] #![feature(float_from_str_radix)] diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 9a786752365f1..0ff3a6907026e 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -209,6 +209,9 @@ impl Condvar { #[unstable(feature = "wait_timeout_with", reason = "unsure if this API is broadly needed or what form it should take", issue = "27748")] + #[rustc_deprecated(since = "1.8.0", + reason = "wonky signature and questionable \ + implementation didn't justify existence")] pub fn wait_timeout_with<'a, T, F>(&self, guard: MutexGuard<'a, T>, dur: Duration, diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index fd538d52fb281..0603dad452804 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -457,6 +457,10 @@ impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> { reason = "recently added, needs RFC for stabilization, questionable interaction with Condvar", issue = "27746")] + #[rustc_deprecated(since = "1.8.0", + reason = "unsound on Mutex because of Condvar and \ + RwLock may also with to be used with Condvar \ + one day")] pub fn map(this: Self, cb: F) -> RwLockReadGuard<'rwlock, U> where F: FnOnce(&T) -> &U { @@ -508,6 +512,10 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> { reason = "recently added, needs RFC for stabilization, questionable interaction with Condvar", issue = "27746")] + #[rustc_deprecated(since = "1.8.0", + reason = "unsound on Mutex because of Condvar and \ + RwLock may also with to be used with Condvar \ + one day")] pub fn map(this: Self, cb: F) -> RwLockWriteGuard<'rwlock, U> where F: FnOnce(&mut T) -> &mut U { diff --git a/src/libstd/sys/windows/compat.rs b/src/libstd/sys/windows/compat.rs index 780a0d9427d59..acbfacce8bd7f 100644 --- a/src/libstd/sys/windows/compat.rs +++ b/src/libstd/sys/windows/compat.rs @@ -28,7 +28,7 @@ use sync::atomic::{AtomicUsize, Ordering}; use sys::c; pub fn lookup(module: &str, symbol: &str) -> Option { - let mut module: Vec = module.utf16_units().collect(); + let mut module: Vec = module.encode_utf16().collect(); module.push(0); let symbol = CString::new(symbol).unwrap(); unsafe { diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index 8f37dc02e87af..1cd05b61d25b0 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -56,7 +56,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result { Output::Pipe(ref p) => return p.get().write(data), }; let utf16 = match str::from_utf8(data).ok() { - Some(utf8) => utf8.utf16_units().collect::>(), + Some(utf8) => utf8.encode_utf16().collect::>(), None => return Err(invalid_encoding()), }; let mut written = 0; diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 116cd5da2ce7b..981ba1e36e9d5 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -188,6 +188,7 @@ pub use self::local::{LocalKey, LocalKeyState}; reason = "scoped TLS has yet to have wide enough use to fully \ consider stabilizing its interface", issue = "27715")] +#[allow(deprecated)] pub use self::scoped_tls::ScopedKey; #[unstable(feature = "libstd_thread_internals", issue = "0")] diff --git a/src/libstd/thread/scoped_tls.rs b/src/libstd/thread/scoped_tls.rs index dc0bc6dfe0245..dea58d016e4ca 100644 --- a/src/libstd/thread/scoped_tls.rs +++ b/src/libstd/thread/scoped_tls.rs @@ -41,6 +41,7 @@ //! ``` #![unstable(feature = "thread_local_internals", issue = "0")] +#![allow(deprecated)] #[doc(hidden)] pub use self::imp::KeyInner as __KeyInner; @@ -56,6 +57,8 @@ pub use self::imp::KeyInner as __KeyInner; reason = "scoped TLS has yet to have wide enough use to fully consider \ stabilizing its interface", issue = "27715")] +#[rustc_deprecated(since = "1.8.0", + reason = "hasn't proven itself over LocalKey")] pub struct ScopedKey { inner: fn() -> &'static imp::KeyInner } /// Declare a new scoped thread local storage key. @@ -68,6 +71,8 @@ pub struct ScopedKey { inner: fn() -> &'static imp::KeyInner } #[unstable(feature = "thread_local_internals", reason = "should not be necessary", issue = "0")] +#[rustc_deprecated(since = "1.8.0", + reason = "hasn't proven itself over LocalKey")] #[macro_export] #[allow_internal_unstable] macro_rules! scoped_thread_local { @@ -85,6 +90,8 @@ macro_rules! scoped_thread_local { #[unstable(feature = "thread_local_internals", reason = "should not be necessary", issue = "0")] +#[rustc_deprecated(since = "1.8.0", + reason = "hasn't proven itself over LocalKey")] #[macro_export] #[allow_internal_unstable] macro_rules! __scoped_thread_local_inner { @@ -101,6 +108,8 @@ macro_rules! __scoped_thread_local_inner { reason = "scoped TLS has yet to have wide enough use to fully consider \ stabilizing its interface", issue = "27715")] +#[rustc_deprecated(since = "1.8.0", + reason = "hasn't proven itself over LocalKey")] impl ScopedKey { #[doc(hidden)] pub const fn new(inner: fn() -> &'static imp::KeyInner) -> ScopedKey { diff --git a/src/libstd/time/mod.rs b/src/libstd/time/mod.rs index a0cf443c0c3fc..aa0a843dc9a54 100644 --- a/src/libstd/time/mod.rs +++ b/src/libstd/time/mod.rs @@ -41,7 +41,7 @@ mod duration; /// allows measuring the duration between two instants (or comparing two /// instants). #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] pub struct Instant(time::Instant); /// A measurement of the system clock, useful for talking to @@ -64,18 +64,18 @@ pub struct Instant(time::Instant); /// fixed point in time, a `SystemTime` can be converted to a human-readable time, /// or perhaps some other string representation. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] pub struct SystemTime(time::SystemTime); -/// An error returned from the `duration_from_earlier` method on `SystemTime`, +/// An error returned from the `duration_since` method on `SystemTime`, /// used to learn about why how far in the opposite direction a timestamp lies. #[derive(Clone, Debug)] -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] pub struct SystemTimeError(Duration); -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] impl Instant { /// Returns an instant corresponding to "now". + #[stable(feature = "time2", since = "1.8.0")] pub fn now() -> Instant { Instant(time::Instant::now()) } @@ -88,6 +88,14 @@ impl Instant { /// only be possible if `earlier` was created after `self`. Because /// `Instant` is monotonic, the only time that this should happen should be /// a bug. + #[stable(feature = "time2", since = "1.8.0")] + pub fn duration_since(&self, earlier: Instant) -> Duration { + self.0.sub_instant(&earlier.0) + } + + /// Deprecated, renamed to `duration_since` + #[unstable(feature = "time2_old", issue = "29866")] + #[rustc_deprecated(since = "1.8.0", reason = "renamed to duration_since")] pub fn duration_from_earlier(&self, earlier: Instant) -> Duration { self.0.sub_instant(&earlier.0) } @@ -99,12 +107,13 @@ impl Instant { /// This function may panic if the current time is earlier than this /// instant, which is something that can happen if an `Instant` is /// produced synthetically. + #[stable(feature = "time2", since = "1.8.0")] pub fn elapsed(&self) -> Duration { - Instant::now().duration_from_earlier(*self) + Instant::now() - *self } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] impl Add for Instant { type Output = Instant; @@ -113,7 +122,7 @@ impl Add for Instant { } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] impl Sub for Instant { type Output = Instant; @@ -122,16 +131,25 @@ impl Sub for Instant { } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] +impl Sub for Instant { + type Output = Duration; + + fn sub(self, other: Instant) -> Duration { + self.duration_since(other) + } +} + +#[stable(feature = "time2", since = "1.8.0")] impl fmt::Debug for Instant { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(f) } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] impl SystemTime { /// Returns the system time corresponding to "now". + #[stable(feature = "time2", since = "1.8.0")] pub fn now() -> SystemTime { SystemTime(time::SystemTime::now()) } @@ -147,6 +165,15 @@ impl SystemTime { /// /// Returns an `Err` if `earlier` is later than `self`, and the error /// contains how far from `self` the time is. + #[stable(feature = "time2", since = "1.8.0")] + pub fn duration_since(&self, earlier: SystemTime) + -> Result { + self.0.sub_time(&earlier.0).map_err(SystemTimeError) + } + + /// Deprecated, renamed to `duration_since` + #[unstable(feature = "time2_old", issue = "29866")] + #[rustc_deprecated(since = "1.8.0", reason = "renamed to duration_since")] pub fn duration_from_earlier(&self, earlier: SystemTime) -> Result { self.0.sub_time(&earlier.0).map_err(SystemTimeError) @@ -162,12 +189,13 @@ impl SystemTime { /// /// Returns an `Err` if `self` is later than the current system time, and /// the error contains how far from the current system time `self` is. + #[stable(feature = "time2", since = "1.8.0")] pub fn elapsed(&self) -> Result { - SystemTime::now().duration_from_earlier(*self) + SystemTime::now().duration_since(*self) } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] impl Add for SystemTime { type Output = SystemTime; @@ -176,7 +204,7 @@ impl Add for SystemTime { } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] impl Sub for SystemTime { type Output = SystemTime; @@ -185,7 +213,7 @@ impl Sub for SystemTime { } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] impl fmt::Debug for SystemTime { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(f) @@ -196,32 +224,32 @@ impl fmt::Debug for SystemTime { /// learn about where in time a `SystemTime` lies. /// /// This constant is defined to be "1970-01-01 00:00:00 UTC" on all systems with -/// respect to the system clock. Using `duration_from_earlier` on an existing +/// respect to the system clock. Using `duration_since` on an existing /// `SystemTime` instance can tell how far away from this point in time a /// measurement lies, and using `UNIX_EPOCH + duration` can be used to create a /// `SystemTime` instance to represent another fixed point in time. -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] pub const UNIX_EPOCH: SystemTime = SystemTime(time::UNIX_EPOCH); -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] impl SystemTimeError { /// Returns the positive duration which represents how far forward the /// second system time was from the first. /// - /// A `SystemTimeError` is returned from the `duration_from_earlier` + /// A `SystemTimeError` is returned from the `duration_since` /// operation whenever the second system time represents a point later /// in time than the `self` of the method call. + #[stable(feature = "time2", since = "1.8.0")] pub fn duration(&self) -> Duration { self.0 } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] impl Error for SystemTimeError { fn description(&self) -> &str { "other time was not earlier than self" } } -#[unstable(feature = "time2", reason = "recently added", issue = "29866")] +#[stable(feature = "time2", since = "1.8.0")] impl fmt::Display for SystemTimeError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "second time provided was later than self") @@ -265,7 +293,7 @@ mod tests { fn instant_math() { let a = Instant::now(); let b = Instant::now(); - let dur = b.duration_from_earlier(a); + let dur = b.duration_since(a); assert_almost_eq!(b - dur, a); assert_almost_eq!(a + dur, b); @@ -277,14 +305,14 @@ mod tests { #[should_panic] fn instant_duration_panic() { let a = Instant::now(); - (a - Duration::new(1, 0)).duration_from_earlier(a); + (a - Duration::new(1, 0)).duration_since(a); } #[test] fn system_time_math() { let a = SystemTime::now(); let b = SystemTime::now(); - match b.duration_from_earlier(a) { + match b.duration_since(a) { Ok(dur) if dur == Duration::new(0, 0) => { assert_almost_eq!(a, b); } @@ -302,8 +330,8 @@ mod tests { } let second = Duration::new(1, 0); - assert_almost_eq!(a.duration_from_earlier(a - second).unwrap(), second); - assert_almost_eq!(a.duration_from_earlier(a + second).unwrap_err() + assert_almost_eq!(a.duration_since(a - second).unwrap(), second); + assert_almost_eq!(a.duration_since(a + second).unwrap_err() .duration(), second); assert_almost_eq!(a - second + second, a); @@ -327,8 +355,8 @@ mod tests { #[test] fn since_epoch() { let ts = SystemTime::now(); - let a = ts.duration_from_earlier(UNIX_EPOCH).unwrap(); - let b = ts.duration_from_earlier(UNIX_EPOCH - Duration::new(1, 0)).unwrap(); + let a = ts.duration_since(UNIX_EPOCH).unwrap(); + let b = ts.duration_since(UNIX_EPOCH - Duration::new(1, 0)).unwrap(); assert!(b > a); assert_eq!(b - a, Duration::new(1, 0)); diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 70bd85c00d453..3f2fb2d3d1704 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -213,10 +213,10 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option, Status ("unwind_attributes", "1.4.0", None, Active), // allow empty structs and enum variants with braces - ("braced_empty_structs", "1.5.0", Some(29720), Active), + ("braced_empty_structs", "1.5.0", Some(29720), Accepted), // allow overloading augmented assignment operations like `a += b` - ("augmented_assignments", "1.5.0", Some(28235), Active), + ("augmented_assignments", "1.5.0", Some(28235), Accepted), // allow `#[no_debug]` ("no_debug", "1.5.0", Some(29721), Active), @@ -563,8 +563,6 @@ pub struct Features { pub cfg_target_feature: bool, pub cfg_target_vendor: bool, pub cfg_target_thread_local: bool, - pub augmented_assignments: bool, - pub braced_empty_structs: bool, pub staged_api: bool, pub stmt_expr_attributes: bool, pub deprecated: bool, @@ -597,8 +595,6 @@ impl Features { cfg_target_feature: false, cfg_target_vendor: false, cfg_target_thread_local: false, - augmented_assignments: false, - braced_empty_structs: false, staged_api: false, stmt_expr_attributes: false, deprecated: false, @@ -956,10 +952,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { fn visit_variant_data(&mut self, s: &'v ast::VariantData, _: ast::Ident, _: &'v ast::Generics, _: ast::NodeId, span: Span) { if s.fields().is_empty() { - if s.is_struct() { - self.gate_feature("braced_empty_structs", span, - "empty structs and enum variants with braces are unstable"); - } else if s.is_tuple() { + if s.is_tuple() { self.context.span_handler.struct_span_err(span, "empty tuple structs and enum \ variants are not allowed, use \ unit structs and enum variants \ @@ -1196,8 +1189,6 @@ fn check_crate_inner(cm: &CodeMap, span_handler: &Handler, cfg_target_feature: cx.has_feature("cfg_target_feature"), cfg_target_vendor: cx.has_feature("cfg_target_vendor"), cfg_target_thread_local: cx.has_feature("cfg_target_thread_local"), - augmented_assignments: cx.has_feature("augmented_assignments"), - braced_empty_structs: cx.has_feature("braced_empty_structs"), staged_api: cx.has_feature("staged_api"), stmt_expr_attributes: cx.has_feature("stmt_expr_attributes"), deprecated: cx.has_feature("deprecated"), diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index e82451937d39c..7536ab9c5afc6 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -40,7 +40,6 @@ #![feature(rustc_private)] #![feature(set_stdio)] #![feature(staged_api)] -#![feature(time2)] extern crate getopts; extern crate serialize; diff --git a/src/test/auxiliary/augmented_assignments.rs b/src/test/auxiliary/augmented_assignments.rs index 9577e1ff0c7d6..6601e7240a780 100644 --- a/src/test/auxiliary/augmented_assignments.rs +++ b/src/test/auxiliary/augmented_assignments.rs @@ -8,15 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(augmented_assignments)] -#![feature(op_assign_traits)] - use std::ops::AddAssign; -pub struct Int(i32); +pub struct Int(pub i32); impl AddAssign for Int { fn add_assign(&mut self, _: i32) { - unimplemented!(); } } diff --git a/src/test/auxiliary/empty-struct.rs b/src/test/auxiliary/empty-struct.rs index 3b92bc3121792..22f65c2b0d8f8 100644 --- a/src/test/auxiliary/empty-struct.rs +++ b/src/test/auxiliary/empty-struct.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(braced_empty_structs)] - pub struct XEmpty1 {} pub struct XEmpty2; diff --git a/src/test/compile-fail/augmented-assignments.rs b/src/test/compile-fail/augmented-assignments.rs index ee64171fd8c1e..221015d512062 100644 --- a/src/test/compile-fail/augmented-assignments.rs +++ b/src/test/compile-fail/augmented-assignments.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(augmented_assignments)] - use std::ops::AddAssign; struct Int(i32); diff --git a/src/test/compile-fail/empty-struct-braces-expr.rs b/src/test/compile-fail/empty-struct-braces-expr.rs index 61e4a1ea3975c..1c86af30c79fd 100644 --- a/src/test/compile-fail/empty-struct-braces-expr.rs +++ b/src/test/compile-fail/empty-struct-braces-expr.rs @@ -12,8 +12,6 @@ // aux-build:empty-struct.rs -#![feature(braced_empty_structs)] - extern crate empty_struct; use empty_struct::*; diff --git a/src/test/compile-fail/empty-struct-braces-pat-1.rs b/src/test/compile-fail/empty-struct-braces-pat-1.rs index 4dd256c68bf75..a5c740d9f638a 100644 --- a/src/test/compile-fail/empty-struct-braces-pat-1.rs +++ b/src/test/compile-fail/empty-struct-braces-pat-1.rs @@ -12,8 +12,6 @@ // aux-build:empty-struct.rs -#![feature(braced_empty_structs)] - extern crate empty_struct; use empty_struct::*; diff --git a/src/test/compile-fail/empty-struct-braces-pat-2.rs b/src/test/compile-fail/empty-struct-braces-pat-2.rs index ac6fbc7e06d5b..0bd96d8209596 100644 --- a/src/test/compile-fail/empty-struct-braces-pat-2.rs +++ b/src/test/compile-fail/empty-struct-braces-pat-2.rs @@ -12,8 +12,6 @@ // aux-build:empty-struct.rs -#![feature(braced_empty_structs)] - extern crate empty_struct; use empty_struct::*; diff --git a/src/test/compile-fail/empty-struct-braces-pat-3.rs b/src/test/compile-fail/empty-struct-braces-pat-3.rs index c973049184fc4..88249fc422f2c 100644 --- a/src/test/compile-fail/empty-struct-braces-pat-3.rs +++ b/src/test/compile-fail/empty-struct-braces-pat-3.rs @@ -12,8 +12,6 @@ // aux-build:empty-struct.rs -#![feature(braced_empty_structs)] - extern crate empty_struct; use empty_struct::*; diff --git a/src/test/compile-fail/empty-struct-unit-expr.rs b/src/test/compile-fail/empty-struct-unit-expr.rs index 822ee9e0dbc10..350b96c764ca6 100644 --- a/src/test/compile-fail/empty-struct-unit-expr.rs +++ b/src/test/compile-fail/empty-struct-unit-expr.rs @@ -12,8 +12,6 @@ // aux-build:empty-struct.rs -#![feature(braced_empty_structs)] - extern crate empty_struct; use empty_struct::*; diff --git a/src/test/compile-fail/empty-struct-unit-pat.rs b/src/test/compile-fail/empty-struct-unit-pat.rs index d399e73be3537..a75290c94053d 100644 --- a/src/test/compile-fail/empty-struct-unit-pat.rs +++ b/src/test/compile-fail/empty-struct-unit-pat.rs @@ -12,9 +12,6 @@ // aux-build:empty-struct.rs -// remove prior feature after warning cycle and promoting warnings to errors -#![feature(braced_empty_structs)] - extern crate empty_struct; use empty_struct::*; diff --git a/src/test/compile-fail/issue-27831.rs b/src/test/compile-fail/issue-27831.rs index ff2846dc705bb..d014c45ad2d17 100644 --- a/src/test/compile-fail/issue-27831.rs +++ b/src/test/compile-fail/issue-27831.rs @@ -22,11 +22,11 @@ fn main() { let Foo { .. } = x; //~ ERROR `Foo` does not name a struct let x = Bar; - Bar { ..x }; //~ ERROR empty structs and enum variants with braces are unstable - let Bar { .. } = x; //~ ERROR empty structs and enum variants with braces are unstable + Bar { ..x }; + let Bar { .. } = x; match Enum::Bar { - Enum::Bar { .. } //~ ERROR empty structs and enum variants with braces are unstable + Enum::Bar { .. } => {} Enum::Foo { .. } //~ ERROR `Enum::Foo` does not name a struct => {} diff --git a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs index b13e34256d229..247e82c2f0924 100644 --- a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs +++ b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-prefer-dynamic + #![allow(dead_code)] #![feature(const_fn)] diff --git a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs index 0bbb9ed128592..220968529de20 100644 --- a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs +++ b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-prefer-dynamic // This would previously leak the Box because we wouldn't // schedule cleanups when auto borrowing trait objects. diff --git a/src/test/run-pass-valgrind/cleanup-stdin.rs b/src/test/run-pass-valgrind/cleanup-stdin.rs index dcdce50c1e9b5..b7c94ed6944f6 100644 --- a/src/test/run-pass-valgrind/cleanup-stdin.rs +++ b/src/test/run-pass-valgrind/cleanup-stdin.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-prefer-dynamic + fn main() { let _ = std::io::stdin(); let _ = std::io::stdout(); diff --git a/src/test/run-pass-valgrind/dst-dtor-1.rs b/src/test/run-pass-valgrind/dst-dtor-1.rs index d051b7b491b94..995da8c73fab8 100644 --- a/src/test/run-pass-valgrind/dst-dtor-1.rs +++ b/src/test/run-pass-valgrind/dst-dtor-1.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-prefer-dynamic + static mut DROP_RAN: bool = false; struct Foo; diff --git a/src/test/run-pass-valgrind/dst-dtor-2.rs b/src/test/run-pass-valgrind/dst-dtor-2.rs index a89873b1277e0..471169340d793 100644 --- a/src/test/run-pass-valgrind/dst-dtor-2.rs +++ b/src/test/run-pass-valgrind/dst-dtor-2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-prefer-dynamic + static mut DROP_RAN: isize = 0; struct Foo; diff --git a/src/test/run-pass-valgrind/exit-flushes.rs b/src/test/run-pass-valgrind/exit-flushes.rs index 632693dd728c3..1897b92140182 100644 --- a/src/test/run-pass-valgrind/exit-flushes.rs +++ b/src/test/run-pass-valgrind/exit-flushes.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-prefer-dynamic // ignore-macos this needs valgrind 3.11 or higher; see // https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679 diff --git a/src/test/run-pass-valgrind/osx-frameworks.rs b/src/test/run-pass-valgrind/osx-frameworks.rs index 41b34dc79bd95..468a20db6f74d 100644 --- a/src/test/run-pass-valgrind/osx-frameworks.rs +++ b/src/test/run-pass-valgrind/osx-frameworks.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-prefer-dynamic // pretty-expanded FIXME #23616 #![feature(libc)] diff --git a/src/test/compile-fail/augmented-assignments-feature-gate-cross.rs b/src/test/run-pass/augmented-assignments-feature-gate-cross.rs similarity index 70% rename from src/test/compile-fail/augmented-assignments-feature-gate-cross.rs rename to src/test/run-pass/augmented-assignments-feature-gate-cross.rs index d4a9830f220ea..b68e011af15f2 100644 --- a/src/test/compile-fail/augmented-assignments-feature-gate-cross.rs +++ b/src/test/run-pass/augmented-assignments-feature-gate-cross.rs @@ -10,9 +10,6 @@ // aux-build:augmented_assignments.rs -// Test that the feature gate is needed when using augmented assignments that were overloaded in -// another crate - extern crate augmented_assignments; use augmented_assignments::Int; @@ -20,6 +17,4 @@ use augmented_assignments::Int; fn main() { let mut x = Int(0); x += 1; - //~^ error: overloaded augmented assignments are not stable - //~| help: add #![feature(augmented_assignments)] to the crate root to enable } diff --git a/src/test/compile-fail/augmented-assignments-feature-gate.rs b/src/test/run-pass/augmented-assignments-feature-gate.rs similarity index 78% rename from src/test/compile-fail/augmented-assignments-feature-gate.rs rename to src/test/run-pass/augmented-assignments-feature-gate.rs index 6f9e9cf945a54..f7e20ee94458f 100644 --- a/src/test/compile-fail/augmented-assignments-feature-gate.rs +++ b/src/test/run-pass/augmented-assignments-feature-gate.rs @@ -14,13 +14,10 @@ struct Int(i32); impl AddAssign for Int { fn add_assign(&mut self, _: i32) { - unimplemented!() } } fn main() { let mut x = Int(0); x += 1; - //~^ error: overloaded augmented assignments are not stable - //~| help: add #![feature(augmented_assignments)] to the crate root to enable } diff --git a/src/test/compile-fail/augmented-assignments-trait.rs b/src/test/run-pass/augmented-assignments-trait.rs similarity index 75% rename from src/test/compile-fail/augmented-assignments-trait.rs rename to src/test/run-pass/augmented-assignments-trait.rs index 83e8d1f3b3870..f1cb2c56dbcf0 100644 --- a/src/test/compile-fail/augmented-assignments-trait.rs +++ b/src/test/run-pass/augmented-assignments-trait.rs @@ -9,14 +9,11 @@ // except according to those terms. use std::ops::AddAssign; -//~^ error: use of unstable library feature 'op_assign_traits' struct Int(i32); impl AddAssign for Int { - //~^ error: use of unstable library feature 'op_assign_traits' fn add_assign(&mut self, _: Int) { - //~^ error: use of unstable library feature 'op_assign_traits' unimplemented!() } } diff --git a/src/test/run-pass/augmented-assignments.rs b/src/test/run-pass/augmented-assignments.rs index eb4c1dbb0b7b7..8c9ebcd274a4b 100644 --- a/src/test/run-pass/augmented-assignments.rs +++ b/src/test/run-pass/augmented-assignments.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(augmented_assignments)] -#![feature(op_assign_traits)] - use std::mem; use std::ops::{ AddAssign, BitAndAssign, BitOrAssign, BitXorAssign, DivAssign, Index, MulAssign, RemAssign, diff --git a/src/test/run-pass/empty-struct-braces-derive.rs b/src/test/run-pass/empty-struct-braces-derive.rs index e54a8245d0bd3..8d19209208dc4 100644 --- a/src/test/run-pass/empty-struct-braces-derive.rs +++ b/src/test/run-pass/empty-struct-braces-derive.rs @@ -10,7 +10,6 @@ // `#[derive(Trait)]` works for empty structs/variants with braces -#![feature(braced_empty_structs)] #![feature(rustc_private)] extern crate serialize as rustc_serialize; diff --git a/src/test/compile-fail/empty-struct-braces-gate-1.rs b/src/test/run-pass/empty-struct-braces-gate-1.rs similarity index 78% rename from src/test/compile-fail/empty-struct-braces-gate-1.rs rename to src/test/run-pass/empty-struct-braces-gate-1.rs index a131b46e1c19b..8287e151326d8 100644 --- a/src/test/compile-fail/empty-struct-braces-gate-1.rs +++ b/src/test/run-pass/empty-struct-braces-gate-1.rs @@ -11,11 +11,11 @@ // Feature gate test for empty struct with braces // Can't define an empty braced struct -struct Empty1 {} //~ ERROR empty structs and enum variants with braces are unstable +struct Empty1 {} struct Empty2; enum E { - Empty4 {}, //~ ERROR empty structs and enum variants with braces are unstable + Empty4 {}, Empty5, } diff --git a/src/test/compile-fail/empty-struct-braces-gate-2.rs b/src/test/run-pass/empty-struct-braces-gate-2.rs similarity index 56% rename from src/test/compile-fail/empty-struct-braces-gate-2.rs rename to src/test/run-pass/empty-struct-braces-gate-2.rs index b2d44301eed8d..0ec3c89859e62 100644 --- a/src/test/compile-fail/empty-struct-braces-gate-2.rs +++ b/src/test/run-pass/empty-struct-braces-gate-2.rs @@ -18,29 +18,29 @@ enum E { } fn main() { - let e2: Empty2 = Empty2 {}; //~ ERROR empty structs and enum variants with braces are unstable + let e2: Empty2 = Empty2 {}; let e2: Empty2 = Empty2; - let e5: E = E::Empty5 {}; //~ ERROR empty structs and enum variants with braces are unstable + let e5: E = E::Empty5 {}; let e5: E = E::Empty5; match e2 { - Empty2 {} => {} //~ ERROR empty structs and enum variants with braces are unstable + Empty2 {} => {} } match e2 { Empty2 => {} } match e2 { - Empty2 { .. } => {} //~ ERROR empty structs and enum variants with braces are unstable + Empty2 { .. } => {} } match e5 { - E::Empty5 {} => {} //~ ERROR empty structs and enum variants with braces are unstable + E::Empty5 {} => {} } match e5 { E::Empty5 => {} } match e5 { - E::Empty5 { .. } => {} //~ ERROR empty structs and enum variants with braces are unstable + E::Empty5 { .. } => {} } - let e22 = Empty2 { ..e2 }; //~ ERROR empty structs and enum variants with braces are unstable + let e22 = Empty2 { ..e2 }; } diff --git a/src/test/run-pass/empty-struct-braces.rs b/src/test/run-pass/empty-struct-braces.rs index 8d6f4d4c30a28..85ae77f20f155 100644 --- a/src/test/run-pass/empty-struct-braces.rs +++ b/src/test/run-pass/empty-struct-braces.rs @@ -13,8 +13,6 @@ // aux-build:empty-struct.rs -#![feature(braced_empty_structs)] - extern crate empty_struct; use empty_struct::*; diff --git a/src/test/run-pass/issue-16819.rs b/src/test/run-pass/issue-16819.rs index a9abb99696f59..fb35ce33157d6 100644 --- a/src/test/run-pass/issue-16819.rs +++ b/src/test/run-pass/issue-16819.rs @@ -10,8 +10,6 @@ //`#[cfg]` on struct field permits empty unusable struct -#![feature(braced_empty_structs)] - struct S { #[cfg(untrue)] a: int, diff --git a/src/test/run-pass/mir_augmented_assignments.rs b/src/test/run-pass/mir_augmented_assignments.rs index c85ac458edd88..dcfa569a933e8 100644 --- a/src/test/run-pass/mir_augmented_assignments.rs +++ b/src/test/run-pass/mir_augmented_assignments.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(augmented_assignments)] -#![feature(op_assign_traits)] #![feature(rustc_attrs)] use std::mem; diff --git a/src/test/run-pass/num-wrapping.rs b/src/test/run-pass/num-wrapping.rs index 33f7b97ef9679..faa02c6698edd 100644 --- a/src/test/run-pass/num-wrapping.rs +++ b/src/test/run-pass/num-wrapping.rs @@ -12,7 +12,7 @@ // // Test std::num::Wrapping for {uN, iN, usize, isize} -#![feature(op_assign_traits, num_bits_bytes, test)] +#![feature(num_bits_bytes, test)] extern crate test; diff --git a/src/test/run-pass/reachable-unnameable-items.rs b/src/test/run-pass/reachable-unnameable-items.rs index 88d3f160c81ea..8a23403359f9a 100644 --- a/src/test/run-pass/reachable-unnameable-items.rs +++ b/src/test/run-pass/reachable-unnameable-items.rs @@ -10,7 +10,6 @@ // aux-build:reachable-unnameable-items.rs -#![feature(braced_empty_structs)] #![feature(recover)] extern crate reachable_unnameable_items;