Auto merge of #31928 - alexcrichton:stabilize-1.8, r=aturon
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 Closes #28235 Closes #29720
This commit is contained in:
commit
52cb8a9d39
|
@ -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:
|
its type with the same name. For example:
|
||||||
|
|
||||||
```
|
```
|
||||||
# #![feature(braced_empty_structs)]
|
|
||||||
struct Cookie;
|
struct Cookie;
|
||||||
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
|
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
|
||||||
```
|
```
|
||||||
|
@ -1149,7 +1148,6 @@ let c = [Cookie, Cookie {}, Cookie, Cookie {}];
|
||||||
is equivalent to
|
is equivalent to
|
||||||
|
|
||||||
```
|
```
|
||||||
# #![feature(braced_empty_structs)]
|
|
||||||
struct Cookie {}
|
struct Cookie {}
|
||||||
const Cookie: Cookie = Cookie {};
|
const Cookie: Cookie = Cookie {};
|
||||||
let c = [Cookie, 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).
|
terms of encapsulation).
|
||||||
* - `default_type_parameter_fallback` - Allows type parameter defaults to
|
* - `default_type_parameter_fallback` - Allows type parameter defaults to
|
||||||
influence type inference.
|
influence type inference.
|
||||||
* - `braced_empty_structs` - Allows use of empty structs and enum variants with braces.
|
|
||||||
|
|
||||||
* - `stmt_expr_attributes` - Allows attributes on expressions and
|
* - `stmt_expr_attributes` - Allows attributes on expressions and
|
||||||
non-item statements.
|
non-item statements.
|
||||||
|
|
|
@ -78,7 +78,6 @@
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(custom_attribute)]
|
#![feature(custom_attribute)]
|
||||||
#![feature(drop_in_place)]
|
|
||||||
#![feature(dropck_parametricity)]
|
#![feature(dropck_parametricity)]
|
||||||
#![feature(fundamental)]
|
#![feature(fundamental)]
|
||||||
#![feature(lang_items)]
|
#![feature(lang_items)]
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
#![feature(alloc)]
|
#![feature(alloc)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(drop_in_place)]
|
|
||||||
#![feature(heap_api)]
|
#![feature(heap_api)]
|
||||||
#![feature(raw)]
|
#![feature(raw)]
|
||||||
#![feature(heap_api)]
|
#![feature(heap_api)]
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(decode_utf16)]
|
#![feature(decode_utf16)]
|
||||||
#![feature(drop_in_place)]
|
|
||||||
#![feature(dropck_parametricity)]
|
#![feature(dropck_parametricity)]
|
||||||
#![feature(fmt_internals)]
|
#![feature(fmt_internals)]
|
||||||
#![feature(fmt_radix)]
|
#![feature(fmt_radix)]
|
||||||
|
|
|
@ -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.
|
/// External iterator for a string's UTF-16 code units.
|
||||||
///
|
///
|
||||||
/// For use with the `std::iter` module.
|
/// For use with the `std::iter` module.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
#[unstable(feature = "str_utf16", issue = "27714")]
|
#[stable(feature = "encode_utf16", since = "1.8.0")]
|
||||||
pub struct Utf16Units<'a> {
|
pub struct EncodeUtf16<'a> {
|
||||||
encoder: Utf16Encoder<Chars<'a>>,
|
encoder: Utf16Encoder<Chars<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<'a> Iterator for Utf16Units<'a> {
|
impl<'a> Iterator for EncodeUtf16<'a> {
|
||||||
type Item = u16;
|
type Item = u16;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -853,10 +858,18 @@ impl str {
|
||||||
#[unstable(feature = "str_utf16",
|
#[unstable(feature = "str_utf16",
|
||||||
reason = "this functionality may only be provided by libunicode",
|
reason = "this functionality may only be provided by libunicode",
|
||||||
issue = "27714")]
|
issue = "27714")]
|
||||||
|
#[rustc_deprecated(since = "1.8.0", reason = "renamed to encode_utf16")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn utf16_units(&self) -> Utf16Units {
|
pub fn utf16_units(&self) -> Utf16Units {
|
||||||
Utf16Units { encoder: Utf16Encoder::new(self[..].chars()) }
|
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
|
/// Returns `true` if the given pattern matches a sub-slice of
|
||||||
/// this string slice.
|
/// this string slice.
|
||||||
///
|
///
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#![feature(step_by)]
|
#![feature(step_by)]
|
||||||
#![feature(str_char)]
|
#![feature(str_char)]
|
||||||
#![feature(str_escape)]
|
#![feature(str_escape)]
|
||||||
#![feature(str_utf16)]
|
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
|
|
|
@ -140,7 +140,7 @@ fn test_from_utf16() {
|
||||||
|
|
||||||
for p in &pairs {
|
for p in &pairs {
|
||||||
let (s, u) = (*p).clone();
|
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();
|
let u_as_string = String::from_utf16(&u).unwrap();
|
||||||
|
|
||||||
assert!(::rustc_unicode::str::is_utf16(&u));
|
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_lossy(&u), s);
|
||||||
|
|
||||||
assert_eq!(String::from_utf16(&s_as_utf16).unwrap(), 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,8 +579,6 @@ impl<'b, T: ?Sized> Ref<'b, T> {
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(cell_extras)]
|
|
||||||
///
|
|
||||||
/// use std::cell::{RefCell, Ref};
|
/// use std::cell::{RefCell, Ref};
|
||||||
///
|
///
|
||||||
/// let c = RefCell::new((5, 'b'));
|
/// 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);
|
/// let b2: Ref<u32> = Ref::map(b1, |t| &t.0);
|
||||||
/// assert_eq!(*b2, 5)
|
/// assert_eq!(*b2, 5)
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "cell_extras", reason = "recently added",
|
#[stable(feature = "cell_map", since = "1.8.0")]
|
||||||
issue = "27746")]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Ref<'b, U>
|
pub fn map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Ref<'b, U>
|
||||||
where F: FnOnce(&T) -> &U
|
where F: FnOnce(&T) -> &U
|
||||||
|
@ -622,6 +619,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "cell_extras", reason = "recently added",
|
#[unstable(feature = "cell_extras", reason = "recently added",
|
||||||
issue = "27746")]
|
issue = "27746")]
|
||||||
|
#[rustc_deprecated(since = "1.8.0", reason = "can be built on Ref::map")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Option<Ref<'b, U>>
|
pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Option<Ref<'b, U>>
|
||||||
where F: FnOnce(&T) -> Option<&U>
|
where F: FnOnce(&T) -> Option<&U>
|
||||||
|
@ -646,7 +644,6 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #![feature(cell_extras)]
|
|
||||||
/// use std::cell::{RefCell, RefMut};
|
/// use std::cell::{RefCell, RefMut};
|
||||||
///
|
///
|
||||||
/// let c = RefCell::new((5, 'b'));
|
/// let c = RefCell::new((5, 'b'));
|
||||||
|
@ -658,8 +655,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
|
||||||
/// }
|
/// }
|
||||||
/// assert_eq!(*c.borrow(), (42, 'b'));
|
/// assert_eq!(*c.borrow(), (42, 'b'));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "cell_extras", reason = "recently added",
|
#[stable(feature = "cell_map", since = "1.8.0")]
|
||||||
issue = "27746")]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U>
|
pub fn map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U>
|
||||||
where F: FnOnce(&mut T) -> &mut 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",
|
#[unstable(feature = "cell_extras", reason = "recently added",
|
||||||
issue = "27746")]
|
issue = "27746")]
|
||||||
|
#[rustc_deprecated(since = "1.8.0", reason = "can be built on RefMut::map")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn filter_map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> Option<RefMut<'b, U>>
|
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>
|
where F: FnOnce(&mut T) -> Option<&mut U>
|
||||||
|
|
|
@ -240,7 +240,7 @@ extern "rust-intrinsic" {
|
||||||
///
|
///
|
||||||
/// This has all the same safety problems as `ptr::read` with respect to
|
/// This has all the same safety problems as `ptr::read` with respect to
|
||||||
/// invalid pointers, types, and double drops.
|
/// 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);
|
pub fn drop_in_place<T: ?Sized>(to_drop: *mut T);
|
||||||
|
|
||||||
/// Gets a static string slice containing the name of a type.
|
/// Gets a static string slice containing the name of a type.
|
||||||
|
|
|
@ -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> {
|
impl AddAssign for Wrapping<$t> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn add_assign(&mut self, other: Wrapping<$t>) {
|
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> {
|
impl SubAssign for Wrapping<$t> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn sub_assign(&mut self, other: Wrapping<$t>) {
|
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> {
|
impl MulAssign for Wrapping<$t> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn mul_assign(&mut self, other: Wrapping<$t>) {
|
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> {
|
impl DivAssign for Wrapping<$t> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn div_assign(&mut self, other: Wrapping<$t>) {
|
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> {
|
impl RemAssign for Wrapping<$t> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn rem_assign(&mut self, other: Wrapping<$t>) {
|
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> {
|
impl BitXorAssign for Wrapping<$t> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn bitxor_assign(&mut self, other: Wrapping<$t>) {
|
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> {
|
impl BitOrAssign for Wrapping<$t> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn bitor_assign(&mut self, other: Wrapping<$t>) {
|
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> {
|
impl BitAndAssign for Wrapping<$t> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn bitand_assign(&mut self, other: Wrapping<$t>) {
|
fn bitand_assign(&mut self, other: Wrapping<$t>) {
|
||||||
|
|
|
@ -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!`.
|
/// calling `add_assign`, and therefore, `main` prints `Adding!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::AddAssign;
|
/// use std::ops::AddAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -911,15 +908,16 @@ shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "add_assign"]
|
#[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> {
|
pub trait AddAssign<Rhs=Self> {
|
||||||
/// The method for the `+=` operator
|
/// The method for the `+=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn add_assign(&mut self, Rhs);
|
fn add_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! add_assign_impl {
|
macro_rules! add_assign_impl {
|
||||||
($($t:ty)+) => ($(
|
($($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 {
|
impl AddAssign for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add_assign(&mut self, other: $t) { *self += other }
|
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!`.
|
/// calling `sub_assign`, and therefore, `main` prints `Subtracting!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::SubAssign;
|
/// use std::ops::SubAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -957,15 +952,16 @@ add_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "sub_assign"]
|
#[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> {
|
pub trait SubAssign<Rhs=Self> {
|
||||||
/// The method for the `-=` operator
|
/// The method for the `-=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn sub_assign(&mut self, Rhs);
|
fn sub_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! sub_assign_impl {
|
macro_rules! sub_assign_impl {
|
||||||
($($t:ty)+) => ($(
|
($($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 {
|
impl SubAssign for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn sub_assign(&mut self, other: $t) { *self -= other }
|
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!`.
|
/// calling `mul_assign`, and therefore, `main` prints `Multiplying!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::MulAssign;
|
/// use std::ops::MulAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -1003,15 +996,16 @@ sub_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "mul_assign"]
|
#[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> {
|
pub trait MulAssign<Rhs=Self> {
|
||||||
/// The method for the `*=` operator
|
/// The method for the `*=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn mul_assign(&mut self, Rhs);
|
fn mul_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! mul_assign_impl {
|
macro_rules! mul_assign_impl {
|
||||||
($($t:ty)+) => ($(
|
($($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 {
|
impl MulAssign for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn mul_assign(&mut self, other: $t) { *self *= other }
|
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!`.
|
/// calling `div_assign`, and therefore, `main` prints `Dividing!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::DivAssign;
|
/// use std::ops::DivAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -1049,15 +1040,16 @@ mul_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "div_assign"]
|
#[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> {
|
pub trait DivAssign<Rhs=Self> {
|
||||||
/// The method for the `/=` operator
|
/// The method for the `/=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn div_assign(&mut self, Rhs);
|
fn div_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! div_assign_impl {
|
macro_rules! div_assign_impl {
|
||||||
($($t:ty)+) => ($(
|
($($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 {
|
impl DivAssign for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn div_assign(&mut self, other: $t) { *self /= other }
|
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!`.
|
/// calling `rem_assign`, and therefore, `main` prints `Remainder-ing!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::RemAssign;
|
/// use std::ops::RemAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -1095,15 +1084,16 @@ div_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "rem_assign"]
|
#[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> {
|
pub trait RemAssign<Rhs=Self> {
|
||||||
/// The method for the `%=` operator
|
/// The method for the `%=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn rem_assign(&mut self, Rhs);
|
fn rem_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! rem_assign_impl {
|
macro_rules! rem_assign_impl {
|
||||||
($($t:ty)+) => ($(
|
($($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 {
|
impl RemAssign for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn rem_assign(&mut self, other: $t) { *self %= other }
|
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!`.
|
/// calling `bitand_assign`, and therefore, `main` prints `Bitwise And-ing!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::BitAndAssign;
|
/// use std::ops::BitAndAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -1141,15 +1128,16 @@ rem_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "bitand_assign"]
|
#[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> {
|
pub trait BitAndAssign<Rhs=Self> {
|
||||||
/// The method for the `&` operator
|
/// The method for the `&` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn bitand_assign(&mut self, Rhs);
|
fn bitand_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! bitand_assign_impl {
|
macro_rules! bitand_assign_impl {
|
||||||
($($t:ty)+) => ($(
|
($($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 {
|
impl BitAndAssign for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn bitand_assign(&mut self, other: $t) { *self &= other }
|
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!`.
|
/// calling `bitor_assign`, and therefore, `main` prints `Bitwise Or-ing!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::BitOrAssign;
|
/// use std::ops::BitOrAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -1187,15 +1172,16 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "bitor_assign"]
|
#[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> {
|
pub trait BitOrAssign<Rhs=Self> {
|
||||||
/// The method for the `|=` operator
|
/// The method for the `|=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn bitor_assign(&mut self, Rhs);
|
fn bitor_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! bitor_assign_impl {
|
macro_rules! bitor_assign_impl {
|
||||||
($($t:ty)+) => ($(
|
($($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 {
|
impl BitOrAssign for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn bitor_assign(&mut self, other: $t) { *self |= other }
|
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!`.
|
/// calling `bitxor_assign`, and therefore, `main` prints `Bitwise Xor-ing!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::BitXorAssign;
|
/// use std::ops::BitXorAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -1233,15 +1216,16 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "bitxor_assign"]
|
#[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> {
|
pub trait BitXorAssign<Rhs=Self> {
|
||||||
/// The method for the `^=` operator
|
/// The method for the `^=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn bitxor_assign(&mut self, Rhs);
|
fn bitxor_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! bitxor_assign_impl {
|
macro_rules! bitxor_assign_impl {
|
||||||
($($t:ty)+) => ($(
|
($($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 {
|
impl BitXorAssign for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn bitxor_assign(&mut self, other: $t) { *self ^= other }
|
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!`.
|
/// calling `shl_assign`, and therefore, `main` prints `Shifting left!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::ShlAssign;
|
/// use std::ops::ShlAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -1279,15 +1260,16 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "shl_assign"]
|
#[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> {
|
pub trait ShlAssign<Rhs> {
|
||||||
/// The method for the `<<=` operator
|
/// The method for the `<<=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn shl_assign(&mut self, Rhs);
|
fn shl_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! shl_assign_impl {
|
macro_rules! shl_assign_impl {
|
||||||
($t:ty, $f:ty) => (
|
($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 {
|
impl ShlAssign<$f> for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn shl_assign(&mut self, other: $f) {
|
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!`.
|
/// calling `shr_assign`, and therefore, `main` prints `Shifting right!`.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(augmented_assignments)]
|
|
||||||
/// #![feature(op_assign_traits)]
|
|
||||||
///
|
|
||||||
/// use std::ops::ShrAssign;
|
/// use std::ops::ShrAssign;
|
||||||
///
|
///
|
||||||
/// struct Foo;
|
/// struct Foo;
|
||||||
|
@ -1343,15 +1322,16 @@ shl_assign_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "shr_assign"]
|
#[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> {
|
pub trait ShrAssign<Rhs=Self> {
|
||||||
/// The method for the `>>=` operator
|
/// The method for the `>>=` operator
|
||||||
|
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||||
fn shr_assign(&mut self, Rhs);
|
fn shr_assign(&mut self, Rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! shr_assign_impl {
|
macro_rules! shr_assign_impl {
|
||||||
($t:ty, $f:ty) => (
|
($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 {
|
impl ShrAssign<$f> for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn shr_assign(&mut self, other: $f) {
|
fn shr_assign(&mut self, other: $f) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub use intrinsics::copy;
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub use intrinsics::write_bytes;
|
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;
|
pub use intrinsics::drop_in_place;
|
||||||
|
|
||||||
/// Creates a null raw pointer.
|
/// Creates a null raw pointer.
|
||||||
|
|
|
@ -159,6 +159,7 @@ fn ref_map_accessor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(deprecated)]
|
||||||
fn ref_filter_map_accessor() {
|
fn ref_filter_map_accessor() {
|
||||||
struct X(RefCell<Result<u32, ()>>);
|
struct X(RefCell<Result<u32, ()>>);
|
||||||
impl X {
|
impl X {
|
||||||
|
@ -189,6 +190,7 @@ fn ref_mut_map_accessor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(deprecated)]
|
||||||
fn ref_mut_filter_map_accessor() {
|
fn ref_mut_filter_map_accessor() {
|
||||||
struct X(RefCell<Result<u32, ()>>);
|
struct X(RefCell<Result<u32, ()>>);
|
||||||
impl X {
|
impl X {
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#![feature(associated_consts)]
|
#![feature(associated_consts)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(cell_extras)]
|
|
||||||
#![feature(collections)]
|
#![feature(collections)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(copy_from_slice)]
|
#![feature(copy_from_slice)]
|
||||||
|
@ -37,11 +36,9 @@
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(scoped_tls)]
|
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(str_char)]
|
#![feature(str_char)]
|
||||||
#![feature(time2)]
|
|
||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
|
|
||||||
extern crate arena;
|
extern crate arena;
|
||||||
|
|
|
@ -448,6 +448,7 @@ pub mod tls {
|
||||||
use rbml::opaque::Encoder as OpaqueEncoder;
|
use rbml::opaque::Encoder as OpaqueEncoder;
|
||||||
use rbml::opaque::Decoder as OpaqueDecoder;
|
use rbml::opaque::Decoder as OpaqueDecoder;
|
||||||
use serialize;
|
use serialize;
|
||||||
|
use std::cell::Cell;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use middle::ty::{self, Ty};
|
use middle::ty::{self, Ty};
|
||||||
use middle::subst::Substs;
|
use middle::subst::Substs;
|
||||||
|
@ -459,12 +460,14 @@ pub mod tls {
|
||||||
fn encode_substs(&self, encoder: &mut OpaqueEncoder, substs: &Substs<'tcx>);
|
fn encode_substs(&self, encoder: &mut OpaqueEncoder, substs: &Substs<'tcx>);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Marker type used for the scoped TLS slot.
|
/// Marker type used for the TLS slot.
|
||||||
/// The type context cannot be used directly because the scoped TLS
|
/// The type context cannot be used directly because the TLS
|
||||||
/// in libstd doesn't allow types generic over lifetimes.
|
/// in libstd doesn't allow types generic over lifetimes.
|
||||||
struct TlsPayload;
|
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.
|
/// Execute f after pushing the given EncodingContext onto the TLS stack.
|
||||||
pub fn enter_encoding_context<'tcx, F, R>(ecx: &EncodingContext<'tcx>,
|
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_payload = (ecx as *const _, encoder as *mut _);
|
||||||
let tls_ptr = &tls_payload as *const _ as *const TlsPayload;
|
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
|
/// 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
|
where F: FnOnce(&EncodingContext, &mut OpaqueEncoder) -> R
|
||||||
{
|
{
|
||||||
TLS_ENCODING.with(|tls| {
|
TLS_ENCODING.with(|tls| {
|
||||||
let tls_payload = (tls as *const TlsPayload)
|
let tls = tls.get().unwrap();
|
||||||
as *mut (&EncodingContext, &mut OpaqueEncoder);
|
let tls_payload = tls as *mut (&EncodingContext, &mut OpaqueEncoder);
|
||||||
f((*tls_payload).0, (*tls_payload).1)
|
f((*tls_payload).0, (*tls_payload).1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -519,7 +528,9 @@ pub mod tls {
|
||||||
fn translate_def_id(&self, def_id: DefId) -> DefId;
|
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.
|
/// Execute f after pushing the given DecodingContext onto the TLS stack.
|
||||||
pub fn enter_decoding_context<'tcx, F, R>(dcx: &DecodingContext<'tcx>,
|
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_payload = (dcx as *const _, decoder as *mut _);
|
||||||
let tls_ptr = &tls_payload as *const _ as *const TlsPayload;
|
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
|
/// 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
|
where F: FnOnce(&DecodingContext, &mut OpaqueDecoder) -> R
|
||||||
{
|
{
|
||||||
TLS_DECODING.with(|tls| {
|
TLS_DECODING.with(|tls| {
|
||||||
let tls_payload = (tls as *const TlsPayload)
|
let tls = tls.get().unwrap();
|
||||||
as *mut (&DecodingContext, &mut OpaqueDecoder);
|
let tls_payload = tls as *mut (&DecodingContext, &mut OpaqueDecoder);
|
||||||
f((*tls_payload).0, (*tls_payload).1)
|
f((*tls_payload).0, (*tls_payload).1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -619,6 +619,7 @@ impl<'a, 'tcx> Lift<'tcx> for &'a Substs<'a> {
|
||||||
pub mod tls {
|
pub mod tls {
|
||||||
use middle::ty;
|
use middle::ty;
|
||||||
|
|
||||||
|
use std::cell::Cell;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use syntax::codemap;
|
use syntax::codemap;
|
||||||
|
|
||||||
|
@ -627,7 +628,9 @@ pub mod tls {
|
||||||
/// in libstd doesn't allow types generic over lifetimes.
|
/// in libstd doesn't allow types generic over lifetimes.
|
||||||
struct ThreadLocalTyCx;
|
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 {
|
fn span_debug(span: codemap::Span, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
with(|tcx| {
|
with(|tcx| {
|
||||||
|
@ -640,18 +643,27 @@ pub mod tls {
|
||||||
let original_span_debug = span_dbg.get();
|
let original_span_debug = span_dbg.get();
|
||||||
span_dbg.set(span_debug);
|
span_dbg.set(span_debug);
|
||||||
let tls_ptr = &tcx as *const _ as *const ThreadLocalTyCx;
|
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);
|
span_dbg.set(original_span_debug);
|
||||||
result
|
result
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with<F: FnOnce(&ty::ctxt) -> R, R>(f: F) -> R {
|
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 {
|
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)))
|
with(|v| f(Some(v)))
|
||||||
} else {
|
} else {
|
||||||
f(None)
|
f(None)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(time2)]
|
|
||||||
|
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
#[macro_use] extern crate syntax;
|
#[macro_use] extern crate syntax;
|
||||||
|
|
|
@ -1418,7 +1418,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
/// Return the dict-like variant corresponding to a given `Def`.
|
/// Return the dict-like variant corresponding to a given `Def`.
|
||||||
pub fn def_struct_variant(&self,
|
pub fn def_struct_variant(&self,
|
||||||
def: Def,
|
def: Def,
|
||||||
span: Span)
|
_span: Span)
|
||||||
-> Option<(ty::AdtDef<'tcx>, ty::VariantDef<'tcx>)>
|
-> Option<(ty::AdtDef<'tcx>, ty::VariantDef<'tcx>)>
|
||||||
{
|
{
|
||||||
let (adt, variant) = match def {
|
let (adt, variant) = match def {
|
||||||
|
@ -1441,15 +1441,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
if var_kind == ty::VariantKind::Struct {
|
if var_kind == ty::VariantKind::Struct {
|
||||||
Some((adt, variant))
|
Some((adt, variant))
|
||||||
} else if var_kind == ty::VariantKind::Unit {
|
} 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))
|
Some((adt, variant))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {},
|
_ => {},
|
||||||
|
|
|
@ -81,7 +81,6 @@ This API is completely unstable and subject to change.
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(cell_extras)]
|
|
||||||
|
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
#[macro_use] extern crate syntax;
|
#[macro_use] extern crate syntax;
|
||||||
|
|
|
@ -226,7 +226,6 @@
|
||||||
#![feature(core_float)]
|
#![feature(core_float)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(decode_utf16)]
|
#![feature(decode_utf16)]
|
||||||
#![feature(drop_in_place)]
|
|
||||||
#![feature(dropck_parametricity)]
|
#![feature(dropck_parametricity)]
|
||||||
#![feature(float_extras)]
|
#![feature(float_extras)]
|
||||||
#![feature(float_from_str_radix)]
|
#![feature(float_from_str_radix)]
|
||||||
|
|
|
@ -209,6 +209,9 @@ impl Condvar {
|
||||||
#[unstable(feature = "wait_timeout_with",
|
#[unstable(feature = "wait_timeout_with",
|
||||||
reason = "unsure if this API is broadly needed or what form it should take",
|
reason = "unsure if this API is broadly needed or what form it should take",
|
||||||
issue = "27748")]
|
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,
|
pub fn wait_timeout_with<'a, T, F>(&self,
|
||||||
guard: MutexGuard<'a, T>,
|
guard: MutexGuard<'a, T>,
|
||||||
dur: Duration,
|
dur: Duration,
|
||||||
|
|
|
@ -457,6 +457,10 @@ impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> {
|
||||||
reason = "recently added, needs RFC for stabilization,
|
reason = "recently added, needs RFC for stabilization,
|
||||||
questionable interaction with Condvar",
|
questionable interaction with Condvar",
|
||||||
issue = "27746")]
|
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>
|
pub fn map<U: ?Sized, F>(this: Self, cb: F) -> RwLockReadGuard<'rwlock, U>
|
||||||
where F: FnOnce(&T) -> &U
|
where F: FnOnce(&T) -> &U
|
||||||
{
|
{
|
||||||
|
@ -508,6 +512,10 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
|
||||||
reason = "recently added, needs RFC for stabilization,
|
reason = "recently added, needs RFC for stabilization,
|
||||||
questionable interaction with Condvar",
|
questionable interaction with Condvar",
|
||||||
issue = "27746")]
|
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>
|
pub fn map<U: ?Sized, F>(this: Self, cb: F) -> RwLockWriteGuard<'rwlock, U>
|
||||||
where F: FnOnce(&mut T) -> &mut U
|
where F: FnOnce(&mut T) -> &mut U
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ use sync::atomic::{AtomicUsize, Ordering};
|
||||||
use sys::c;
|
use sys::c;
|
||||||
|
|
||||||
pub fn lookup(module: &str, symbol: &str) -> Option<usize> {
|
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);
|
module.push(0);
|
||||||
let symbol = CString::new(symbol).unwrap();
|
let symbol = CString::new(symbol).unwrap();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -56,7 +56,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result<usize> {
|
||||||
Output::Pipe(ref p) => return p.get().write(data),
|
Output::Pipe(ref p) => return p.get().write(data),
|
||||||
};
|
};
|
||||||
let utf16 = match str::from_utf8(data).ok() {
|
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()),
|
None => return Err(invalid_encoding()),
|
||||||
};
|
};
|
||||||
let mut written = 0;
|
let mut written = 0;
|
||||||
|
|
|
@ -188,6 +188,7 @@ pub use self::local::{LocalKey, LocalKeyState};
|
||||||
reason = "scoped TLS has yet to have wide enough use to fully \
|
reason = "scoped TLS has yet to have wide enough use to fully \
|
||||||
consider stabilizing its interface",
|
consider stabilizing its interface",
|
||||||
issue = "27715")]
|
issue = "27715")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub use self::scoped_tls::ScopedKey;
|
pub use self::scoped_tls::ScopedKey;
|
||||||
|
|
||||||
#[unstable(feature = "libstd_thread_internals", issue = "0")]
|
#[unstable(feature = "libstd_thread_internals", issue = "0")]
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![unstable(feature = "thread_local_internals", issue = "0")]
|
#![unstable(feature = "thread_local_internals", issue = "0")]
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use self::imp::KeyInner as __KeyInner;
|
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 \
|
reason = "scoped TLS has yet to have wide enough use to fully consider \
|
||||||
stabilizing its interface",
|
stabilizing its interface",
|
||||||
issue = "27715")]
|
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> }
|
pub struct ScopedKey<T:'static> { inner: fn() -> &'static imp::KeyInner<T> }
|
||||||
|
|
||||||
/// Declare a new scoped thread local storage key.
|
/// 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",
|
#[unstable(feature = "thread_local_internals",
|
||||||
reason = "should not be necessary",
|
reason = "should not be necessary",
|
||||||
issue = "0")]
|
issue = "0")]
|
||||||
|
#[rustc_deprecated(since = "1.8.0",
|
||||||
|
reason = "hasn't proven itself over LocalKey")]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[allow_internal_unstable]
|
#[allow_internal_unstable]
|
||||||
macro_rules! scoped_thread_local {
|
macro_rules! scoped_thread_local {
|
||||||
|
@ -85,6 +90,8 @@ macro_rules! scoped_thread_local {
|
||||||
#[unstable(feature = "thread_local_internals",
|
#[unstable(feature = "thread_local_internals",
|
||||||
reason = "should not be necessary",
|
reason = "should not be necessary",
|
||||||
issue = "0")]
|
issue = "0")]
|
||||||
|
#[rustc_deprecated(since = "1.8.0",
|
||||||
|
reason = "hasn't proven itself over LocalKey")]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[allow_internal_unstable]
|
#[allow_internal_unstable]
|
||||||
macro_rules! __scoped_thread_local_inner {
|
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 \
|
reason = "scoped TLS has yet to have wide enough use to fully consider \
|
||||||
stabilizing its interface",
|
stabilizing its interface",
|
||||||
issue = "27715")]
|
issue = "27715")]
|
||||||
|
#[rustc_deprecated(since = "1.8.0",
|
||||||
|
reason = "hasn't proven itself over LocalKey")]
|
||||||
impl<T> ScopedKey<T> {
|
impl<T> ScopedKey<T> {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub const fn new(inner: fn() -> &'static imp::KeyInner<T>) -> ScopedKey<T> {
|
pub const fn new(inner: fn() -> &'static imp::KeyInner<T>) -> ScopedKey<T> {
|
||||||
|
|
|
@ -41,7 +41,7 @@ mod duration;
|
||||||
/// allows measuring the duration between two instants (or comparing two
|
/// allows measuring the duration between two instants (or comparing two
|
||||||
/// instants).
|
/// instants).
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[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);
|
pub struct Instant(time::Instant);
|
||||||
|
|
||||||
/// A measurement of the system clock, useful for talking to
|
/// 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,
|
/// fixed point in time, a `SystemTime` can be converted to a human-readable time,
|
||||||
/// or perhaps some other string representation.
|
/// or perhaps some other string representation.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[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);
|
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.
|
/// used to learn about why how far in the opposite direction a timestamp lies.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
|
#[stable(feature = "time2", since = "1.8.0")]
|
||||||
pub struct SystemTimeError(Duration);
|
pub struct SystemTimeError(Duration);
|
||||||
|
|
||||||
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
|
|
||||||
impl Instant {
|
impl Instant {
|
||||||
/// Returns an instant corresponding to "now".
|
/// Returns an instant corresponding to "now".
|
||||||
|
#[stable(feature = "time2", since = "1.8.0")]
|
||||||
pub fn now() -> Instant {
|
pub fn now() -> Instant {
|
||||||
Instant(time::Instant::now())
|
Instant(time::Instant::now())
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,14 @@ impl Instant {
|
||||||
/// only be possible if `earlier` was created after `self`. Because
|
/// only be possible if `earlier` was created after `self`. Because
|
||||||
/// `Instant` is monotonic, the only time that this should happen should be
|
/// `Instant` is monotonic, the only time that this should happen should be
|
||||||
/// a bug.
|
/// 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 {
|
pub fn duration_from_earlier(&self, earlier: Instant) -> Duration {
|
||||||
self.0.sub_instant(&earlier.0)
|
self.0.sub_instant(&earlier.0)
|
||||||
}
|
}
|
||||||
|
@ -99,12 +107,13 @@ impl Instant {
|
||||||
/// This function may panic if the current time is earlier than this
|
/// This function may panic if the current time is earlier than this
|
||||||
/// instant, which is something that can happen if an `Instant` is
|
/// instant, which is something that can happen if an `Instant` is
|
||||||
/// produced synthetically.
|
/// produced synthetically.
|
||||||
|
#[stable(feature = "time2", since = "1.8.0")]
|
||||||
pub fn elapsed(&self) -> Duration {
|
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 {
|
impl Add<Duration> for Instant {
|
||||||
type Output = 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 {
|
impl Sub<Duration> for Instant {
|
||||||
type Output = 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 {
|
impl fmt::Debug for Instant {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
self.0.fmt(f)
|
self.0.fmt(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
|
|
||||||
impl SystemTime {
|
impl SystemTime {
|
||||||
/// Returns the system time corresponding to "now".
|
/// Returns the system time corresponding to "now".
|
||||||
|
#[stable(feature = "time2", since = "1.8.0")]
|
||||||
pub fn now() -> SystemTime {
|
pub fn now() -> SystemTime {
|
||||||
SystemTime(time::SystemTime::now())
|
SystemTime(time::SystemTime::now())
|
||||||
}
|
}
|
||||||
|
@ -147,6 +165,15 @@ impl SystemTime {
|
||||||
///
|
///
|
||||||
/// Returns an `Err` if `earlier` is later than `self`, and the error
|
/// Returns an `Err` if `earlier` is later than `self`, and the error
|
||||||
/// contains how far from `self` the time is.
|
/// 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)
|
pub fn duration_from_earlier(&self, earlier: SystemTime)
|
||||||
-> Result<Duration, SystemTimeError> {
|
-> Result<Duration, SystemTimeError> {
|
||||||
self.0.sub_time(&earlier.0).map_err(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
|
/// 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.
|
/// 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> {
|
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 {
|
impl Add<Duration> for SystemTime {
|
||||||
type Output = 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 {
|
impl Sub<Duration> for SystemTime {
|
||||||
type Output = 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 {
|
impl fmt::Debug for SystemTime {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
self.0.fmt(f)
|
self.0.fmt(f)
|
||||||
|
@ -196,32 +224,32 @@ impl fmt::Debug for SystemTime {
|
||||||
/// learn about where in time a `SystemTime` lies.
|
/// 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
|
/// 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
|
/// `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
|
/// measurement lies, and using `UNIX_EPOCH + duration` can be used to create a
|
||||||
/// `SystemTime` instance to represent another fixed point in time.
|
/// `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);
|
pub const UNIX_EPOCH: SystemTime = SystemTime(time::UNIX_EPOCH);
|
||||||
|
|
||||||
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
|
|
||||||
impl SystemTimeError {
|
impl SystemTimeError {
|
||||||
/// Returns the positive duration which represents how far forward the
|
/// Returns the positive duration which represents how far forward the
|
||||||
/// second system time was from the first.
|
/// 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
|
/// operation whenever the second system time represents a point later
|
||||||
/// in time than the `self` of the method call.
|
/// in time than the `self` of the method call.
|
||||||
|
#[stable(feature = "time2", since = "1.8.0")]
|
||||||
pub fn duration(&self) -> Duration {
|
pub fn duration(&self) -> Duration {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
|
#[stable(feature = "time2", since = "1.8.0")]
|
||||||
impl Error for SystemTimeError {
|
impl Error for SystemTimeError {
|
||||||
fn description(&self) -> &str { "other time was not earlier than self" }
|
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 {
|
impl fmt::Display for SystemTimeError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "second time provided was later than self")
|
write!(f, "second time provided was later than self")
|
||||||
|
@ -265,7 +293,7 @@ mod tests {
|
||||||
fn instant_math() {
|
fn instant_math() {
|
||||||
let a = Instant::now();
|
let a = Instant::now();
|
||||||
let b = 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!(b - dur, a);
|
||||||
assert_almost_eq!(a + dur, b);
|
assert_almost_eq!(a + dur, b);
|
||||||
|
|
||||||
|
@ -277,14 +305,14 @@ mod tests {
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn instant_duration_panic() {
|
fn instant_duration_panic() {
|
||||||
let a = Instant::now();
|
let a = Instant::now();
|
||||||
(a - Duration::new(1, 0)).duration_from_earlier(a);
|
(a - Duration::new(1, 0)).duration_since(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn system_time_math() {
|
fn system_time_math() {
|
||||||
let a = SystemTime::now();
|
let a = SystemTime::now();
|
||||||
let b = 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) => {
|
Ok(dur) if dur == Duration::new(0, 0) => {
|
||||||
assert_almost_eq!(a, b);
|
assert_almost_eq!(a, b);
|
||||||
}
|
}
|
||||||
|
@ -302,8 +330,8 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
let second = Duration::new(1, 0);
|
let second = Duration::new(1, 0);
|
||||||
assert_almost_eq!(a.duration_from_earlier(a - second).unwrap(), second);
|
assert_almost_eq!(a.duration_since(a - second).unwrap(), second);
|
||||||
assert_almost_eq!(a.duration_from_earlier(a + second).unwrap_err()
|
assert_almost_eq!(a.duration_since(a + second).unwrap_err()
|
||||||
.duration(), second);
|
.duration(), second);
|
||||||
|
|
||||||
assert_almost_eq!(a - second + second, a);
|
assert_almost_eq!(a - second + second, a);
|
||||||
|
@ -327,8 +355,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn since_epoch() {
|
fn since_epoch() {
|
||||||
let ts = SystemTime::now();
|
let ts = SystemTime::now();
|
||||||
let a = ts.duration_from_earlier(UNIX_EPOCH).unwrap();
|
let a = ts.duration_since(UNIX_EPOCH).unwrap();
|
||||||
let b = ts.duration_from_earlier(UNIX_EPOCH - Duration::new(1, 0)).unwrap();
|
let b = ts.duration_since(UNIX_EPOCH - Duration::new(1, 0)).unwrap();
|
||||||
assert!(b > a);
|
assert!(b > a);
|
||||||
assert_eq!(b - a, Duration::new(1, 0));
|
assert_eq!(b - a, Duration::new(1, 0));
|
||||||
|
|
||||||
|
|
|
@ -213,10 +213,10 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
|
||||||
("unwind_attributes", "1.4.0", None, Active),
|
("unwind_attributes", "1.4.0", None, Active),
|
||||||
|
|
||||||
// allow empty structs and enum variants with braces
|
// 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`
|
// 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]`
|
// allow `#[no_debug]`
|
||||||
("no_debug", "1.5.0", Some(29721), Active),
|
("no_debug", "1.5.0", Some(29721), Active),
|
||||||
|
@ -563,8 +563,6 @@ pub struct Features {
|
||||||
pub cfg_target_feature: bool,
|
pub cfg_target_feature: bool,
|
||||||
pub cfg_target_vendor: bool,
|
pub cfg_target_vendor: bool,
|
||||||
pub cfg_target_thread_local: bool,
|
pub cfg_target_thread_local: bool,
|
||||||
pub augmented_assignments: bool,
|
|
||||||
pub braced_empty_structs: bool,
|
|
||||||
pub staged_api: bool,
|
pub staged_api: bool,
|
||||||
pub stmt_expr_attributes: bool,
|
pub stmt_expr_attributes: bool,
|
||||||
pub deprecated: bool,
|
pub deprecated: bool,
|
||||||
|
@ -597,8 +595,6 @@ impl Features {
|
||||||
cfg_target_feature: false,
|
cfg_target_feature: false,
|
||||||
cfg_target_vendor: false,
|
cfg_target_vendor: false,
|
||||||
cfg_target_thread_local: false,
|
cfg_target_thread_local: false,
|
||||||
augmented_assignments: false,
|
|
||||||
braced_empty_structs: false,
|
|
||||||
staged_api: false,
|
staged_api: false,
|
||||||
stmt_expr_attributes: false,
|
stmt_expr_attributes: false,
|
||||||
deprecated: 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,
|
fn visit_variant_data(&mut self, s: &'v ast::VariantData, _: ast::Ident,
|
||||||
_: &'v ast::Generics, _: ast::NodeId, span: Span) {
|
_: &'v ast::Generics, _: ast::NodeId, span: Span) {
|
||||||
if s.fields().is_empty() {
|
if s.fields().is_empty() {
|
||||||
if s.is_struct() {
|
if s.is_tuple() {
|
||||||
self.gate_feature("braced_empty_structs", span,
|
|
||||||
"empty structs and enum variants with braces are unstable");
|
|
||||||
} else if s.is_tuple() {
|
|
||||||
self.context.span_handler.struct_span_err(span, "empty tuple structs and enum \
|
self.context.span_handler.struct_span_err(span, "empty tuple structs and enum \
|
||||||
variants are not allowed, use \
|
variants are not allowed, use \
|
||||||
unit structs and enum variants \
|
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_feature: cx.has_feature("cfg_target_feature"),
|
||||||
cfg_target_vendor: cx.has_feature("cfg_target_vendor"),
|
cfg_target_vendor: cx.has_feature("cfg_target_vendor"),
|
||||||
cfg_target_thread_local: cx.has_feature("cfg_target_thread_local"),
|
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"),
|
staged_api: cx.has_feature("staged_api"),
|
||||||
stmt_expr_attributes: cx.has_feature("stmt_expr_attributes"),
|
stmt_expr_attributes: cx.has_feature("stmt_expr_attributes"),
|
||||||
deprecated: cx.has_feature("deprecated"),
|
deprecated: cx.has_feature("deprecated"),
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(set_stdio)]
|
#![feature(set_stdio)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(time2)]
|
|
||||||
|
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
|
|
|
@ -8,15 +8,11 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(augmented_assignments)]
|
|
||||||
#![feature(op_assign_traits)]
|
|
||||||
|
|
||||||
use std::ops::AddAssign;
|
use std::ops::AddAssign;
|
||||||
|
|
||||||
pub struct Int(i32);
|
pub struct Int(pub i32);
|
||||||
|
|
||||||
impl AddAssign<i32> for Int {
|
impl AddAssign<i32> for Int {
|
||||||
fn add_assign(&mut self, _: i32) {
|
fn add_assign(&mut self, _: i32) {
|
||||||
unimplemented!();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
pub struct XEmpty1 {}
|
pub struct XEmpty1 {}
|
||||||
pub struct XEmpty2;
|
pub struct XEmpty2;
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(augmented_assignments)]
|
|
||||||
|
|
||||||
use std::ops::AddAssign;
|
use std::ops::AddAssign;
|
||||||
|
|
||||||
struct Int(i32);
|
struct Int(i32);
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
// aux-build:empty-struct.rs
|
// aux-build:empty-struct.rs
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
extern crate empty_struct;
|
extern crate empty_struct;
|
||||||
use empty_struct::*;
|
use empty_struct::*;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
// aux-build:empty-struct.rs
|
// aux-build:empty-struct.rs
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
extern crate empty_struct;
|
extern crate empty_struct;
|
||||||
use empty_struct::*;
|
use empty_struct::*;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
// aux-build:empty-struct.rs
|
// aux-build:empty-struct.rs
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
extern crate empty_struct;
|
extern crate empty_struct;
|
||||||
use empty_struct::*;
|
use empty_struct::*;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
// aux-build:empty-struct.rs
|
// aux-build:empty-struct.rs
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
extern crate empty_struct;
|
extern crate empty_struct;
|
||||||
use empty_struct::*;
|
use empty_struct::*;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
// aux-build:empty-struct.rs
|
// aux-build:empty-struct.rs
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
extern crate empty_struct;
|
extern crate empty_struct;
|
||||||
use empty_struct::*;
|
use empty_struct::*;
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
|
|
||||||
// aux-build:empty-struct.rs
|
// aux-build:empty-struct.rs
|
||||||
|
|
||||||
// remove prior feature after warning cycle and promoting warnings to errors
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
extern crate empty_struct;
|
extern crate empty_struct;
|
||||||
use empty_struct::*;
|
use empty_struct::*;
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,11 @@ fn main() {
|
||||||
let Foo { .. } = x; //~ ERROR `Foo` does not name a struct
|
let Foo { .. } = x; //~ ERROR `Foo` does not name a struct
|
||||||
|
|
||||||
let x = Bar;
|
let x = Bar;
|
||||||
Bar { ..x }; //~ ERROR empty structs and enum variants with braces are unstable
|
Bar { ..x };
|
||||||
let Bar { .. } = x; //~ ERROR empty structs and enum variants with braces are unstable
|
let Bar { .. } = x;
|
||||||
|
|
||||||
match Enum::Bar {
|
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
|
Enum::Foo { .. } //~ ERROR `Enum::Foo` does not name a struct
|
||||||
=> {}
|
=> {}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// no-prefer-dynamic
|
||||||
|
|
||||||
// This would previously leak the Box<Trait> because we wouldn't
|
// This would previously leak the Box<Trait> because we wouldn't
|
||||||
// schedule cleanups when auto borrowing trait objects.
|
// schedule cleanups when auto borrowing trait objects.
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// no-prefer-dynamic
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = std::io::stdin();
|
let _ = std::io::stdin();
|
||||||
let _ = std::io::stdout();
|
let _ = std::io::stdout();
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// no-prefer-dynamic
|
||||||
|
|
||||||
static mut DROP_RAN: bool = false;
|
static mut DROP_RAN: bool = false;
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// no-prefer-dynamic
|
||||||
|
|
||||||
static mut DROP_RAN: isize = 0;
|
static mut DROP_RAN: isize = 0;
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// no-prefer-dynamic
|
||||||
// ignore-macos this needs valgrind 3.11 or higher; see
|
// ignore-macos this needs valgrind 3.11 or higher; see
|
||||||
// https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
|
// https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// no-prefer-dynamic
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
|
|
||||||
// aux-build:augmented_assignments.rs
|
// 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;
|
extern crate augmented_assignments;
|
||||||
|
|
||||||
use augmented_assignments::Int;
|
use augmented_assignments::Int;
|
||||||
|
@ -20,6 +17,4 @@ use augmented_assignments::Int;
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = Int(0);
|
let mut x = Int(0);
|
||||||
x += 1;
|
x += 1;
|
||||||
//~^ error: overloaded augmented assignments are not stable
|
|
||||||
//~| help: add #![feature(augmented_assignments)] to the crate root to enable
|
|
||||||
}
|
}
|
|
@ -14,13 +14,10 @@ struct Int(i32);
|
||||||
|
|
||||||
impl AddAssign<i32> for Int {
|
impl AddAssign<i32> for Int {
|
||||||
fn add_assign(&mut self, _: i32) {
|
fn add_assign(&mut self, _: i32) {
|
||||||
unimplemented!()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = Int(0);
|
let mut x = Int(0);
|
||||||
x += 1;
|
x += 1;
|
||||||
//~^ error: overloaded augmented assignments are not stable
|
|
||||||
//~| help: add #![feature(augmented_assignments)] to the crate root to enable
|
|
||||||
}
|
}
|
|
@ -9,14 +9,11 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::ops::AddAssign;
|
use std::ops::AddAssign;
|
||||||
//~^ error: use of unstable library feature 'op_assign_traits'
|
|
||||||
|
|
||||||
struct Int(i32);
|
struct Int(i32);
|
||||||
|
|
||||||
impl AddAssign for Int {
|
impl AddAssign for Int {
|
||||||
//~^ error: use of unstable library feature 'op_assign_traits'
|
|
||||||
fn add_assign(&mut self, _: Int) {
|
fn add_assign(&mut self, _: Int) {
|
||||||
//~^ error: use of unstable library feature 'op_assign_traits'
|
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,9 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(augmented_assignments)]
|
|
||||||
#![feature(op_assign_traits)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::{
|
use std::ops::{
|
||||||
AddAssign, BitAndAssign, BitOrAssign, BitXorAssign, DivAssign, Index, MulAssign, RemAssign,
|
AddAssign, BitAndAssign, BitOrAssign, BitXorAssign, DivAssign, Index, MulAssign, RemAssign,
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// `#[derive(Trait)]` works for empty structs/variants with braces
|
// `#[derive(Trait)]` works for empty structs/variants with braces
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
|
|
||||||
extern crate serialize as rustc_serialize;
|
extern crate serialize as rustc_serialize;
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
// Feature gate test for empty struct with braces
|
// Feature gate test for empty struct with braces
|
||||||
// Can't define an empty braced struct
|
// Can't define an empty braced struct
|
||||||
|
|
||||||
struct Empty1 {} //~ ERROR empty structs and enum variants with braces are unstable
|
struct Empty1 {}
|
||||||
struct Empty2;
|
struct Empty2;
|
||||||
|
|
||||||
enum E {
|
enum E {
|
||||||
Empty4 {}, //~ ERROR empty structs and enum variants with braces are unstable
|
Empty4 {},
|
||||||
Empty5,
|
Empty5,
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,29 +18,29 @@ enum E {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
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 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;
|
let e5: E = E::Empty5;
|
||||||
|
|
||||||
match e2 {
|
match e2 {
|
||||||
Empty2 {} => {} //~ ERROR empty structs and enum variants with braces are unstable
|
Empty2 {} => {}
|
||||||
}
|
}
|
||||||
match e2 {
|
match e2 {
|
||||||
Empty2 => {}
|
Empty2 => {}
|
||||||
}
|
}
|
||||||
match e2 {
|
match e2 {
|
||||||
Empty2 { .. } => {} //~ ERROR empty structs and enum variants with braces are unstable
|
Empty2 { .. } => {}
|
||||||
}
|
}
|
||||||
match e5 {
|
match e5 {
|
||||||
E::Empty5 {} => {} //~ ERROR empty structs and enum variants with braces are unstable
|
E::Empty5 {} => {}
|
||||||
}
|
}
|
||||||
match e5 {
|
match e5 {
|
||||||
E::Empty5 => {}
|
E::Empty5 => {}
|
||||||
}
|
}
|
||||||
match e5 {
|
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 };
|
||||||
}
|
}
|
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
// aux-build:empty-struct.rs
|
// aux-build:empty-struct.rs
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
extern crate empty_struct;
|
extern crate empty_struct;
|
||||||
use empty_struct::*;
|
use empty_struct::*;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
//`#[cfg]` on struct field permits empty unusable struct
|
//`#[cfg]` on struct field permits empty unusable struct
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
|
|
||||||
struct S {
|
struct S {
|
||||||
#[cfg(untrue)]
|
#[cfg(untrue)]
|
||||||
a: int,
|
a: int,
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(augmented_assignments)]
|
|
||||||
#![feature(op_assign_traits)]
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
//
|
//
|
||||||
// Test std::num::Wrapping<T> for {uN, iN, usize, isize}
|
// 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;
|
extern crate test;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:reachable-unnameable-items.rs
|
// aux-build:reachable-unnameable-items.rs
|
||||||
|
|
||||||
#![feature(braced_empty_structs)]
|
|
||||||
#![feature(recover)]
|
#![feature(recover)]
|
||||||
|
|
||||||
extern crate reachable_unnameable_items;
|
extern crate reachable_unnameable_items;
|
||||||
|
|
Loading…
Reference in New Issue