std: Stabilize APIs for the 1.8 release

This commit is the result of the FCPs ending for the 1.8 release cycle for both
the libs and the lang suteams. The full list of changes are:

Stabilized

* `braced_empty_structs`
* `augmented_assignments`
* `str::encode_utf16` - renamed from `utf16_units`
* `str::EncodeUtf16` - renamed from `Utf16Units`
* `Ref::map`
* `RefMut::map`
* `ptr::drop_in_place`
* `time::Instant`
* `time::SystemTime`
* `{Instant,SystemTime}::now`
* `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier`
* `{Instant,SystemTime}::elapsed`
* Various `Add`/`Sub` impls for `Time` and `SystemTime`
* `SystemTimeError`
* `SystemTimeError::duration`
* Various impls for `SystemTimeError`
* `UNIX_EPOCH`
* `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign`

Deprecated

* Scoped TLS (the `scoped_thread_local!` macro)
* `Ref::filter_map`
* `RefMut::filter_map`
* `RwLockReadGuard::map`
* `RwLockWriteGuard::map`
* `Condvar::wait_timeout_with`

Closes #27714
Closes #27715
Closes #27746
Closes #27748
Closes #27908
Closes #29866
This commit is contained in:
Alex Crichton 2016-02-25 15:52:29 -08:00
parent 504ca6f422
commit b643782a10
52 changed files with 203 additions and 227 deletions

View File

@ -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.

View File

@ -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)]

View File

@ -31,7 +31,6 @@
#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(drop_in_place)]
#![feature(heap_api)]
#![feature(raw)]
#![feature(heap_api)]

View File

@ -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)]

View File

@ -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]
@ -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.
///

View File

@ -29,7 +29,6 @@
#![feature(step_by)]
#![feature(str_char)]
#![feature(str_escape)]
#![feature(str_utf16)]
#![feature(test)]
#![feature(unboxed_closures)]
#![feature(unicode)]

View File

@ -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));
@ -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);
}
}

View File

@ -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<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
@ -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>
@ -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<U: ?Sized, F>(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<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> Option<RefMut<'b, U>>
where F: FnOnce(&mut T) -> Option<&mut U>

View File

@ -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.

View File

@ -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>) {

View File

@ -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<Rhs=Self> {
/// 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<Rhs=Self> {
/// 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<Rhs=Self> {
/// 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<Rhs=Self> {
/// 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<Rhs=Self> {
/// 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<Rhs=Self> {
/// 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<Rhs=Self> {
/// 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<Rhs=Self> {
/// 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<Rhs> {
/// 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<Rhs=Self> {
/// 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) {

View File

@ -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.

View File

@ -159,6 +159,7 @@ fn ref_map_accessor() {
}
#[test]
#[allow(deprecated)]
fn ref_filter_map_accessor() {
struct X(RefCell<Result<u32, ()>>);
impl X {
@ -189,6 +190,7 @@ fn ref_mut_map_accessor() {
}
#[test]
#[allow(deprecated)]
fn ref_mut_filter_map_accessor() {
struct X(RefCell<Result<u32, ()>>);
impl X {

View File

@ -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;

View File

@ -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<Option<*const TlsPayload>> = 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<Option<*const TlsPayload>> = 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)
})
}

View File

@ -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<Option<*const ThreadLocalTyCx>> = 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<F: FnOnce(&ty::ctxt) -> 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<F: FnOnce(Option<&ty::ctxt>) -> 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)

View File

@ -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;

View File

@ -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

View File

@ -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()
}
}
}
}
_ => {},

View File

@ -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;

View File

@ -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)]

View File

@ -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,

View File

@ -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<U: ?Sized, F>(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<U: ?Sized, F>(this: Self, cb: F) -> RwLockWriteGuard<'rwlock, U>
where F: FnOnce(&mut T) -> &mut U
{

View File

@ -28,7 +28,7 @@ use sync::atomic::{AtomicUsize, Ordering};
use sys::c;
pub fn lookup(module: &str, symbol: &str) -> Option<usize> {
let mut module: Vec<u16> = module.utf16_units().collect();
let mut module: Vec<u16> = module.encode_utf16().collect();
module.push(0);
let symbol = CString::new(symbol).unwrap();
unsafe {

View File

@ -56,7 +56,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result<usize> {
Output::Pipe(ref p) => return p.get().write(data),
};
let utf16 = match str::from_utf8(data).ok() {
Some(utf8) => utf8.utf16_units().collect::<Vec<u16>>(),
Some(utf8) => utf8.encode_utf16().collect::<Vec<u16>>(),
None => return Err(invalid_encoding()),
};
let mut written = 0;

View File

@ -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")]

View File

@ -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<T:'static> { inner: fn() -> &'static imp::KeyInner<T> }
/// Declare a new scoped thread local storage key.
@ -68,6 +71,8 @@ pub struct ScopedKey<T:'static> { inner: fn() -> &'static imp::KeyInner<T> }
#[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<T> ScopedKey<T> {
#[doc(hidden)]
pub const fn new(inner: fn() -> &'static imp::KeyInner<T>) -> ScopedKey<T> {

View File

@ -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<Duration> for Instant {
type Output = Instant;
@ -113,7 +122,7 @@ impl Add<Duration> for Instant {
}
}
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
#[stable(feature = "time2", since = "1.8.0")]
impl Sub<Duration> for Instant {
type Output = Instant;
@ -122,16 +131,25 @@ impl Sub<Duration> for Instant {
}
}
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
#[stable(feature = "time2", since = "1.8.0")]
impl Sub<Instant> 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<Duration, SystemTimeError> {
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<Duration, SystemTimeError> {
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<Duration, SystemTimeError> {
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<Duration> for SystemTime {
type Output = SystemTime;
@ -176,7 +204,7 @@ impl Add<Duration> for SystemTime {
}
}
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
#[stable(feature = "time2", since = "1.8.0")]
impl Sub<Duration> for SystemTime {
type Output = SystemTime;
@ -185,7 +213,7 @@ impl Sub<Duration> 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));

View File

@ -213,10 +213,10 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, 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<F>(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"),

View File

@ -40,7 +40,6 @@
#![feature(rustc_private)]
#![feature(set_stdio)]
#![feature(staged_api)]
#![feature(time2)]
extern crate getopts;
extern crate serialize;

View File

@ -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<i32> for Int {
fn add_assign(&mut self, _: i32) {
unimplemented!();
}
}

View File

@ -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;

View File

@ -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);

View File

@ -12,8 +12,6 @@
// aux-build:empty-struct.rs
#![feature(braced_empty_structs)]
extern crate empty_struct;
use empty_struct::*;

View File

@ -12,8 +12,6 @@
// aux-build:empty-struct.rs
#![feature(braced_empty_structs)]
extern crate empty_struct;
use empty_struct::*;

View File

@ -12,8 +12,6 @@
// aux-build:empty-struct.rs
#![feature(braced_empty_structs)]
extern crate empty_struct;
use empty_struct::*;

View File

@ -12,8 +12,6 @@
// aux-build:empty-struct.rs
#![feature(braced_empty_structs)]
extern crate empty_struct;
use empty_struct::*;

View File

@ -12,8 +12,6 @@
// aux-build:empty-struct.rs
#![feature(braced_empty_structs)]
extern crate empty_struct;
use empty_struct::*;

View File

@ -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::*;

View File

@ -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
=> {}

View File

@ -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
}

View File

@ -14,13 +14,10 @@ struct Int(i32);
impl AddAssign<i32> 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
}

View File

@ -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!()
}
}

View File

@ -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,

View File

@ -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;

View File

@ -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,
}

View File

@ -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 };
}

View File

@ -13,8 +13,6 @@
// aux-build:empty-struct.rs
#![feature(braced_empty_structs)]
extern crate empty_struct;
use empty_struct::*;

View File

@ -10,8 +10,6 @@
//`#[cfg]` on struct field permits empty unusable struct
#![feature(braced_empty_structs)]
struct S {
#[cfg(untrue)]
a: int,

View File

@ -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;

View File

@ -12,7 +12,7 @@
//
// Test std::num::Wrapping<T> for {uN, iN, usize, isize}
#![feature(op_assign_traits, num_bits_bytes, test)]
#![feature(num_bits_bytes, test)]
extern crate test;

View File

@ -10,7 +10,6 @@
// aux-build:reachable-unnameable-items.rs
#![feature(braced_empty_structs)]
#![feature(recover)]
extern crate reachable_unnameable_items;