Skip to content

Commit b643782

Browse files
committed
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
1 parent 504ca6f commit b643782

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+203
-227
lines changed

src/doc/reference.md

-3
Original file line numberDiff line numberDiff line change
@@ -1141,15 +1141,13 @@ the list of fields entirely. Such a struct implicitly defines a constant of
11411141
its type with the same name. For example:
11421142

11431143
```
1144-
# #![feature(braced_empty_structs)]
11451144
struct Cookie;
11461145
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
11471146
```
11481147

11491148
is equivalent to
11501149

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

23902387
* - `stmt_expr_attributes` - Allows attributes on expressions and
23912388
non-item statements.

src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
#![feature(const_fn)]
7979
#![feature(core_intrinsics)]
8080
#![feature(custom_attribute)]
81-
#![feature(drop_in_place)]
8281
#![feature(dropck_parametricity)]
8382
#![feature(fundamental)]
8483
#![feature(lang_items)]

src/libarena/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
#![feature(alloc)]
3333
#![feature(core_intrinsics)]
34-
#![feature(drop_in_place)]
3534
#![feature(heap_api)]
3635
#![feature(raw)]
3736
#![feature(heap_api)]

src/libcollections/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#![feature(box_syntax)]
3636
#![feature(core_intrinsics)]
3737
#![feature(decode_utf16)]
38-
#![feature(drop_in_place)]
3938
#![feature(dropck_parametricity)]
4039
#![feature(fmt_internals)]
4140
#![feature(fmt_radix)]

src/libcollections/str.rs

+16-3
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,22 @@ impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
112112
}
113113
}
114114

115+
/// Deprecated, renamed to EncodeUtf16
116+
#[unstable(feature = "str_utf16", issue = "27714")]
117+
#[rustc_deprecated(since = "1.8.0", reason = "renamed to EncodeUtf16")]
118+
pub type Utf16Units<'a> = EncodeUtf16<'a>;
119+
115120
/// External iterator for a string's UTF-16 code units.
116121
///
117122
/// For use with the `std::iter` module.
118123
#[derive(Clone)]
119-
#[unstable(feature = "str_utf16", issue = "27714")]
120-
pub struct Utf16Units<'a> {
124+
#[stable(feature = "encode_utf16", since = "1.8.0")]
125+
pub struct EncodeUtf16<'a> {
121126
encoder: Utf16Encoder<Chars<'a>>,
122127
}
123128

124129
#[stable(feature = "rust1", since = "1.0.0")]
125-
impl<'a> Iterator for Utf16Units<'a> {
130+
impl<'a> Iterator for EncodeUtf16<'a> {
126131
type Item = u16;
127132

128133
#[inline]
@@ -853,10 +858,18 @@ impl str {
853858
#[unstable(feature = "str_utf16",
854859
reason = "this functionality may only be provided by libunicode",
855860
issue = "27714")]
861+
#[rustc_deprecated(since = "1.8.0", reason = "renamed to encode_utf16")]
862+
#[allow(deprecated)]
856863
pub fn utf16_units(&self) -> Utf16Units {
857864
Utf16Units { encoder: Utf16Encoder::new(self[..].chars()) }
858865
}
859866

867+
/// Returns an iterator of `u16` over the string encoded as UTF-16.
868+
#[stable(feature = "encode_utf16", since = "1.8.0")]
869+
pub fn encode_utf16(&self) -> EncodeUtf16 {
870+
EncodeUtf16 { encoder: Utf16Encoder::new(self[..].chars()) }
871+
}
872+
860873
/// Returns `true` if the given pattern matches a sub-slice of
861874
/// this string slice.
862875
///

src/libcollectionstest/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#![feature(step_by)]
3030
#![feature(str_char)]
3131
#![feature(str_escape)]
32-
#![feature(str_utf16)]
3332
#![feature(test)]
3433
#![feature(unboxed_closures)]
3534
#![feature(unicode)]

src/libcollectionstest/string.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn test_from_utf16() {
140140

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

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

152152
assert_eq!(String::from_utf16(&s_as_utf16).unwrap(), s);
153-
assert_eq!(u_as_string.utf16_units().collect::<Vec<u16>>(), u);
153+
assert_eq!(u_as_string.encode_utf16().collect::<Vec<u16>>(), u);
154154
}
155155
}
156156

src/libcore/cell.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -579,17 +579,14 @@ impl<'b, T: ?Sized> Ref<'b, T> {
579579
/// # Example
580580
///
581581
/// ```
582-
/// #![feature(cell_extras)]
583-
///
584582
/// use std::cell::{RefCell, Ref};
585583
///
586584
/// let c = RefCell::new((5, 'b'));
587585
/// let b1: Ref<(u32, char)> = c.borrow();
588586
/// let b2: Ref<u32> = Ref::map(b1, |t| &t.0);
589587
/// assert_eq!(*b2, 5)
590588
/// ```
591-
#[unstable(feature = "cell_extras", reason = "recently added",
592-
issue = "27746")]
589+
#[stable(feature = "cell_map", since = "1.8.0")]
593590
#[inline]
594591
pub fn map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Ref<'b, U>
595592
where F: FnOnce(&T) -> &U
@@ -622,6 +619,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
622619
/// ```
623620
#[unstable(feature = "cell_extras", reason = "recently added",
624621
issue = "27746")]
622+
#[rustc_deprecated(since = "1.8.0", reason = "can be built on Ref::map")]
625623
#[inline]
626624
pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Option<Ref<'b, U>>
627625
where F: FnOnce(&T) -> Option<&U>
@@ -646,7 +644,6 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
646644
/// # Example
647645
///
648646
/// ```
649-
/// # #![feature(cell_extras)]
650647
/// use std::cell::{RefCell, RefMut};
651648
///
652649
/// let c = RefCell::new((5, 'b'));
@@ -658,8 +655,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
658655
/// }
659656
/// assert_eq!(*c.borrow(), (42, 'b'));
660657
/// ```
661-
#[unstable(feature = "cell_extras", reason = "recently added",
662-
issue = "27746")]
658+
#[stable(feature = "cell_map", since = "1.8.0")]
663659
#[inline]
664660
pub fn map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U>
665661
where F: FnOnce(&mut T) -> &mut U
@@ -698,6 +694,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
698694
/// ```
699695
#[unstable(feature = "cell_extras", reason = "recently added",
700696
issue = "27746")]
697+
#[rustc_deprecated(since = "1.8.0", reason = "can be built on RefMut::map")]
701698
#[inline]
702699
pub fn filter_map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> Option<RefMut<'b, U>>
703700
where F: FnOnce(&mut T) -> Option<&mut U>

src/libcore/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ extern "rust-intrinsic" {
240240
///
241241
/// This has all the same safety problems as `ptr::read` with respect to
242242
/// invalid pointers, types, and double drops.
243-
#[unstable(feature = "drop_in_place", reason = "just exposed, needs FCP", issue = "27908")]
243+
#[stable(feature = "drop_in_place", since = "1.8.0")]
244244
pub fn drop_in_place<T: ?Sized>(to_drop: *mut T);
245245

246246
/// Gets a static string slice containing the name of a type.

src/libcore/num/wrapping.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ macro_rules! wrapping_impl {
156156
}
157157
}
158158

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)