Skip to content

Commit f0b1326

Browse files
committed
std: Stabilize/deprecate features for 1.4
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the libs team decision for all library features this cycle. Stabilized APIs: * `<Box<str>>::into_string` * `Arc::downgrade` * `Arc::get_mut` * `Arc::make_mut` * `Arc::try_unwrap` * `Box::from_raw` * `Box::into_raw` * `CStr::to_str` * `CStr::to_string_lossy` * `CString::from_raw` * `CString::into_raw` * `IntoRawFd::into_raw_fd` * `IntoRawFd` * `IntoRawHandle::into_raw_handle` * `IntoRawHandle` * `IntoRawSocket::into_raw_socket` * `IntoRawSocket` * `Rc::downgrade` * `Rc::get_mut` * `Rc::make_mut` * `Rc::try_unwrap` * `Result::expect` * `String::into_boxed_slice` * `TcpSocket::read_timeout` * `TcpSocket::set_read_timeout` * `TcpSocket::set_write_timeout` * `TcpSocket::write_timeout` * `UdpSocket::read_timeout` * `UdpSocket::set_read_timeout` * `UdpSocket::set_write_timeout` * `UdpSocket::write_timeout` * `Vec::append` * `Vec::split_off` * `VecDeque::append` * `VecDeque::retain` * `VecDeque::split_off` * `rc::Weak::upgrade` * `rc::Weak` * `slice::Iter::as_slice` * `slice::IterMut::into_slice` * `str::CharIndices::as_str` * `str::Chars::as_str` * `str::split_at_mut` * `str::split_at` * `sync::Weak::upgrade` * `sync::Weak` * `thread::park_timeout` * `thread::sleep` Deprecated APIs * `BTreeMap::with_b` * `BTreeSet::with_b` * `Option::as_mut_slice` * `Option::as_slice` * `Result::as_mut_slice` * `Result::as_slice` * `f32::from_str_radix` * `f64::from_str_radix` Closes rust-lang#27277 Closes rust-lang#27718 Closes rust-lang#27736 Closes rust-lang#27764 Closes rust-lang#27765 Closes rust-lang#27766 Closes rust-lang#27767 Closes rust-lang#27768 Closes rust-lang#27769 Closes rust-lang#27771 Closes rust-lang#27773 Closes rust-lang#27775 Closes rust-lang#27776 Closes rust-lang#27785 Closes rust-lang#27792 Closes rust-lang#27795 Closes rust-lang#27797
1 parent 79c6a4d commit f0b1326

File tree

31 files changed

+121
-140
lines changed

31 files changed

+121
-140
lines changed

src/liballoc/arc.rs

+13-17
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
137137
/// Weak pointers will not keep the data inside of the `Arc` alive, and can be
138138
/// used to break cycles between `Arc` pointers.
139139
#[unsafe_no_drop_flag]
140-
#[unstable(feature = "arc_weak", reason = "needs FCP", issue = "27718")]
140+
#[stable(feature = "arc_weak", since = "1.4.0")]
141141
pub struct Weak<T: ?Sized> {
142142
// FIXME #12808: strange name to try to avoid interfering with
143143
// field accesses of the contained type via Deref
@@ -201,7 +201,6 @@ impl<T> Arc<T> {
201201
/// # Examples
202202
///
203203
/// ```
204-
/// #![feature(arc_unique)]
205204
/// use std::sync::Arc;
206205
///
207206
/// let x = Arc::new(3);
@@ -212,7 +211,7 @@ impl<T> Arc<T> {
212211
/// assert_eq!(Arc::try_unwrap(x), Err(Arc::new(4)));
213212
/// ```
214213
#[inline]
215-
#[unstable(feature = "arc_unique", reason = "needs FCP", issue = "27718")]
214+
#[stable(feature = "arc_unique", since = "1.4.0")]
216215
pub fn try_unwrap(this: Self) -> Result<T, Self> {
217216
// See `drop` for why all these atomics are like this
218217
if this.inner().strong.compare_and_swap(1, 0, Release) != 1 { return Err(this) }
@@ -238,14 +237,13 @@ impl<T: ?Sized> Arc<T> {
238237
/// # Examples
239238
///
240239
/// ```
241-
/// #![feature(arc_weak)]
242240
/// use std::sync::Arc;
243241
///
244242
/// let five = Arc::new(5);
245243
///
246244
/// let weak_five = Arc::downgrade(&five);
247245
/// ```
248-
#[unstable(feature = "arc_weak", reason = "needs FCP", issue = "27718")]
246+
#[stable(feature = "arc_weak", since = "1.4.0")]
249247
pub fn downgrade(this: &Self) -> Weak<T> {
250248
loop {
251249
// This Relaxed is OK because we're checking the value in the CAS
@@ -270,14 +268,16 @@ impl<T: ?Sized> Arc<T> {
270268

271269
/// Get the number of weak references to this value.
272270
#[inline]
273-
#[unstable(feature = "arc_counts", reason = "not clearly useful, and racy", issue = "27718")]
271+
#[unstable(feature = "arc_counts", reason = "not clearly useful, and racy",
272+
issue = "28356")]
274273
pub fn weak_count(this: &Self) -> usize {
275274
this.inner().weak.load(SeqCst) - 1
276275
}
277276

278277
/// Get the number of strong references to this value.
279278
#[inline]
280-
#[unstable(feature = "arc_counts", reason = "not clearly useful, and racy", issue = "27718")]
279+
#[unstable(feature = "arc_counts", reason = "not clearly useful, and racy",
280+
issue = "28356")]
281281
pub fn strong_count(this: &Self) -> usize {
282282
this.inner().strong.load(SeqCst)
283283
}
@@ -366,7 +366,8 @@ impl<T: ?Sized> Deref for Arc<T> {
366366
}
367367

368368
impl<T: Clone> Arc<T> {
369-
#[unstable(feature = "arc_unique", reason = "renamed to Arc::make_mut", issue = "27718")]
369+
#[unstable(feature = "arc_make_unique", reason = "renamed to Arc::make_mut",
370+
issue = "27718")]
370371
#[deprecated(since = "1.4.0", reason = "renamed to Arc::make_mut")]
371372
pub fn make_unique(this: &mut Self) -> &mut T {
372373
Arc::make_mut(this)
@@ -381,7 +382,6 @@ impl<T: Clone> Arc<T> {
381382
/// # Examples
382383
///
383384
/// ```
384-
/// #![feature(arc_unique)]
385385
/// use std::sync::Arc;
386386
///
387387
/// let mut data = Arc::new(5);
@@ -398,7 +398,7 @@ impl<T: Clone> Arc<T> {
398398
///
399399
/// ```
400400
#[inline]
401-
#[unstable(feature = "arc_unique", reason = "needs FCP", issue = "27718")]
401+
#[stable(feature = "arc_unique", since = "1.4.0")]
402402
pub fn make_mut(this: &mut Self) -> &mut T {
403403
// Note that we hold both a strong reference and a weak reference.
404404
// Thus, releasing our strong reference only will not, by itself, cause
@@ -460,7 +460,6 @@ impl<T: ?Sized> Arc<T> {
460460
/// # Examples
461461
///
462462
/// ```
463-
/// #![feature(arc_unique)]
464463
/// use std::sync::Arc;
465464
///
466465
/// let mut x = Arc::new(3);
@@ -471,7 +470,7 @@ impl<T: ?Sized> Arc<T> {
471470
/// assert!(Arc::get_mut(&mut x).is_none());
472471
/// ```
473472
#[inline]
474-
#[unstable(feature = "arc_unique", reason = "needs FCP", issue = "27718")]
473+
#[stable(feature = "arc_unique", since = "1.4.0")]
475474
pub fn get_mut(this: &mut Self) -> Option<&mut T> {
476475
if this.is_unique() {
477476
// This unsafety is ok because we're guaranteed that the pointer
@@ -595,7 +594,6 @@ impl<T: ?Sized> Weak<T> {
595594
/// # Examples
596595
///
597596
/// ```
598-
/// #![feature(arc_weak)]
599597
/// use std::sync::Arc;
600598
///
601599
/// let five = Arc::new(5);
@@ -604,7 +602,7 @@ impl<T: ?Sized> Weak<T> {
604602
///
605603
/// let strong_five: Option<Arc<_>> = weak_five.upgrade();
606604
/// ```
607-
#[unstable(feature = "arc_weak", reason = "needs FCP", issue = "27718")]
605+
#[stable(feature = "arc_weak", since = "1.4.0")]
608606
pub fn upgrade(&self) -> Option<Arc<T>> {
609607
// We use a CAS loop to increment the strong count instead of a
610608
// fetch_add because once the count hits 0 it must never be above 0.
@@ -630,7 +628,7 @@ impl<T: ?Sized> Weak<T> {
630628
}
631629
}
632630

633-
#[unstable(feature = "arc_weak", reason = "needs FCP", issue = "27718")]
631+
#[stable(feature = "arc_weak", since = "1.4.0")]
634632
impl<T: ?Sized> Clone for Weak<T> {
635633
/// Makes a clone of the `Weak<T>`.
636634
///
@@ -639,7 +637,6 @@ impl<T: ?Sized> Clone for Weak<T> {
639637
/// # Examples
640638
///
641639
/// ```
642-
/// #![feature(arc_weak)]
643640
/// use std::sync::Arc;
644641
///
645642
/// let weak_five = Arc::downgrade(&Arc::new(5));
@@ -672,7 +669,6 @@ impl<T: ?Sized> Drop for Weak<T> {
672669
/// # Examples
673670
///
674671
/// ```
675-
/// #![feature(arc_weak)]
676672
/// use std::sync::Arc;
677673
///
678674
/// {

src/liballoc/boxed.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,8 @@ impl<T : ?Sized> Box<T> {
226226
/// Function is unsafe, because improper use of this function may
227227
/// lead to memory problems like double-free, for example if the
228228
/// function is called twice on the same raw pointer.
229-
#[unstable(feature = "box_raw",
230-
reason = "may be renamed or moved out of Box scope",
231-
issue = "27768")]
229+
#[stable(feature = "box_raw", since = "1.4.0")]
232230
#[inline]
233-
// NB: may want to be called from_ptr, see comments on CStr::from_ptr
234231
pub unsafe fn from_raw(raw: *mut T) -> Self {
235232
mem::transmute(raw)
236233
}
@@ -244,17 +241,14 @@ impl<T : ?Sized> Box<T> {
244241
/// `Box` does not specify, how memory is allocated.
245242
///
246243
/// # Examples
247-
/// ```
248-
/// #![feature(box_raw)]
249244
///
245+
/// ```
250246
/// let seventeen = Box::new(17u32);
251247
/// let raw = Box::into_raw(seventeen);
252248
/// let boxed_again = unsafe { Box::from_raw(raw) };
253249
/// ```
254-
#[unstable(feature = "box_raw", reason = "may be renamed",
255-
issue = "27768")]
250+
#[stable(feature = "box_raw", since = "1.4.0")]
256251
#[inline]
257-
// NB: may want to be called into_ptr, see comments on CStr::from_ptr
258252
pub fn into_raw(b: Box<T>) -> *mut T {
259253
unsafe { mem::transmute(b) }
260254
}
@@ -289,8 +283,6 @@ impl<T: Clone> Clone for Box<T> {
289283
/// # Examples
290284
///
291285
/// ```
292-
/// #![feature(box_raw)]
293-
///
294286
/// let x = Box::new(5);
295287
/// let mut y = Box::new(10);
296288
///

src/liballoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
#![cfg_attr(stage0, feature(alloc_system))]
101101
#![cfg_attr(not(stage0), feature(needs_allocator))]
102102

103-
#![cfg_attr(test, feature(test, rustc_private, box_raw))]
103+
#![cfg_attr(test, feature(test, rustc_private))]
104104

105105
#[cfg(stage0)]
106106
extern crate alloc_system;

src/liballoc/rc.rs

+18-26
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// FIXME(27718): rc_counts stuff is useful internally, but was previously public
1211
#![allow(deprecated)]
1312

1413
//! Thread-local reference-counted boxes (the `Rc<T>` type).
@@ -94,8 +93,6 @@
9493
//! documentation for more details on interior mutability.
9594
//!
9695
//! ```rust
97-
//! #![feature(rc_weak)]
98-
//!
9996
//! use std::rc::Rc;
10097
//! use std::rc::Weak;
10198
//! use std::cell::RefCell;
@@ -242,7 +239,7 @@ impl<T> Rc<T> {
242239
/// assert_eq!(Rc::try_unwrap(x), Err(Rc::new(4)));
243240
/// ```
244241
#[inline]
245-
#[unstable(feature = "rc_unique", reason= "needs FCP", issue = "27718")]
242+
#[stable(feature = "rc_unique", since = "1.4.0")]
246243
pub fn try_unwrap(this: Self) -> Result<T, Self> {
247244
if Rc::would_unwrap(&this) {
248245
unsafe {
@@ -263,8 +260,9 @@ impl<T> Rc<T> {
263260
}
264261

265262
/// Checks if `Rc::try_unwrap` would return `Ok`.
266-
#[unstable(feature = "rc_would_unwrap", reason = "just added for niche usecase",
267-
issue = "27718")]
263+
#[unstable(feature = "rc_would_unwrap",
264+
reason = "just added for niche usecase",
265+
issue = "28356")]
268266
pub fn would_unwrap(this: &Self) -> bool {
269267
Rc::strong_count(&this) == 1
270268
}
@@ -276,28 +274,28 @@ impl<T: ?Sized> Rc<T> {
276274
/// # Examples
277275
///
278276
/// ```
279-
/// #![feature(rc_weak)]
280-
///
281277
/// use std::rc::Rc;
282278
///
283279
/// let five = Rc::new(5);
284280
///
285281
/// let weak_five = Rc::downgrade(&five);
286282
/// ```
287-
#[unstable(feature = "rc_weak", reason = "needs FCP", issue = "27718")]
283+
#[stable(feature = "rc_weak", since = "1.4.0")]
288284
pub fn downgrade(this: &Self) -> Weak<T> {
289285
this.inc_weak();
290286
Weak { _ptr: this._ptr }
291287
}
292288

293289
/// Get the number of weak references to this value.
294290
#[inline]
295-
#[unstable(feature = "rc_counts", reason = "not clearly useful", issue = "27718")]
291+
#[unstable(feature = "rc_counts", reason = "not clearly useful",
292+
issue = "28356")]
296293
pub fn weak_count(this: &Self) -> usize { this.weak() - 1 }
297294

298295
/// Get the number of strong references to this value.
299296
#[inline]
300-
#[unstable(feature = "rc_counts", reason = "not clearly useful", issue = "27718")]
297+
#[unstable(feature = "rc_counts", reason = "not clearly useful",
298+
issue = "28356")]
301299
pub fn strong_count(this: &Self) -> usize { this.strong() }
302300

303301
/// Returns true if there are no other `Rc` or `Weak<T>` values that share
@@ -315,7 +313,8 @@ impl<T: ?Sized> Rc<T> {
315313
/// assert!(Rc::is_unique(&five));
316314
/// ```
317315
#[inline]
318-
#[unstable(feature = "rc_counts", reason = "uniqueness has unclear meaning", issue = "27718")]
316+
#[unstable(feature = "rc_counts", reason = "uniqueness has unclear meaning",
317+
issue = "28356")]
319318
pub fn is_unique(this: &Self) -> bool {
320319
Rc::weak_count(this) == 0 && Rc::strong_count(this) == 1
321320
}
@@ -328,8 +327,6 @@ impl<T: ?Sized> Rc<T> {
328327
/// # Examples
329328
///
330329
/// ```
331-
/// #![feature(rc_unique)]
332-
///
333330
/// use std::rc::Rc;
334331
///
335332
/// let mut x = Rc::new(3);
@@ -340,7 +337,7 @@ impl<T: ?Sized> Rc<T> {
340337
/// assert!(Rc::get_mut(&mut x).is_none());
341338
/// ```
342339
#[inline]
343-
#[unstable(feature = "rc_unique", reason = "needs FCP", issue = "27718")]
340+
#[stable(feature = "rc_unique", since = "1.4.0")]
344341
pub fn get_mut(this: &mut Self) -> Option<&mut T> {
345342
if Rc::is_unique(this) {
346343
let inner = unsafe { &mut **this._ptr };
@@ -353,7 +350,8 @@ impl<T: ?Sized> Rc<T> {
353350

354351
impl<T: Clone> Rc<T> {
355352
#[inline]
356-
#[unstable(feature = "rc_unique", reason = "renamed to Rc::make_mut", issue = "27718")]
353+
#[unstable(feature = "rc_make_unique", reason = "renamed to Rc::make_mut",
354+
issue = "27718")]
357355
#[deprecated(since = "1.4.0", reason = "renamed to Rc::make_mut")]
358356
pub fn make_unique(&mut self) -> &mut T {
359357
Rc::make_mut(self)
@@ -385,7 +383,7 @@ impl<T: Clone> Rc<T> {
385383
///
386384
/// ```
387385
#[inline]
388-
#[unstable(feature = "rc_unique", reason = "needs FCP", issue = "27718")]
386+
#[stable(feature = "rc_unique", since = "1.4.0")]
389387
pub fn make_mut(this: &mut Self) -> &mut T {
390388
if Rc::strong_count(this) != 1 {
391389
// Gotta clone the data, there are other Rcs
@@ -693,7 +691,7 @@ impl<T> fmt::Pointer for Rc<T> {
693691
///
694692
/// See the [module level documentation](./index.html) for more.
695693
#[unsafe_no_drop_flag]
696-
#[unstable(feature = "rc_weak", reason = "needs FCP", issue = "27718")]
694+
#[stable(feature = "rc_weak", since = "1.4.0")]
697695
pub struct Weak<T: ?Sized> {
698696
// FIXME #12808: strange names to try to avoid interfering with
699697
// field accesses of the contained type via Deref
@@ -716,8 +714,6 @@ impl<T: ?Sized> Weak<T> {
716714
/// # Examples
717715
///
718716
/// ```
719-
/// #![feature(rc_weak)]
720-
///
721717
/// use std::rc::Rc;
722718
///
723719
/// let five = Rc::new(5);
@@ -726,7 +722,7 @@ impl<T: ?Sized> Weak<T> {
726722
///
727723
/// let strong_five: Option<Rc<_>> = weak_five.upgrade();
728724
/// ```
729-
#[unstable(feature = "rc_weak", reason = "needs FCP", issue = "27718")]
725+
#[stable(feature = "rc_weak", since = "1.4.0")]
730726
pub fn upgrade(&self) -> Option<Rc<T>> {
731727
if self.strong() == 0 {
732728
None
@@ -746,8 +742,6 @@ impl<T: ?Sized> Drop for Weak<T> {
746742
/// # Examples
747743
///
748744
/// ```
749-
/// #![feature(rc_weak)]
750-
///
751745
/// use std::rc::Rc;
752746
///
753747
/// {
@@ -783,7 +777,7 @@ impl<T: ?Sized> Drop for Weak<T> {
783777
}
784778
}
785779

786-
#[unstable(feature = "rc_weak", reason = "needs FCP", issue = "27718")]
780+
#[stable(feature = "rc_weak", since = "1.4.0")]
787781
impl<T: ?Sized> Clone for Weak<T> {
788782

789783
/// Makes a clone of the `Weak<T>`.
@@ -793,8 +787,6 @@ impl<T: ?Sized> Clone for Weak<T> {
793787
/// # Examples
794788
///
795789
/// ```
796-
/// #![feature(rc_weak)]
797-
///
798790
/// use std::rc::Rc;
799791
///
800792
/// let weak_five = Rc::downgrade(&Rc::new(5));

src/libcollections/btree/map.rs

+3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ pub struct OccupiedEntry<'a, K:'a, V:'a> {
149149
impl<K: Ord, V> BTreeMap<K, V> {
150150
/// Makes a new empty BTreeMap with a reasonable choice for B.
151151
#[stable(feature = "rust1", since = "1.0.0")]
152+
#[allow(deprecated)]
152153
pub fn new() -> BTreeMap<K, V> {
153154
//FIXME(Gankro): Tune this as a function of size_of<K/V>?
154155
BTreeMap::with_b(6)
@@ -160,6 +161,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
160161
#[unstable(feature = "btree_b",
161162
reason = "probably want this to be on the type, eventually",
162163
issue = "27795")]
164+
#[deprecated(since = "1.4.0", reason = "niche API")]
163165
pub fn with_b(b: usize) -> BTreeMap<K, V> {
164166
assert!(b > 1, "B must be greater than 1");
165167
BTreeMap {
@@ -183,6 +185,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
183185
/// assert!(a.is_empty());
184186
/// ```
185187
#[stable(feature = "rust1", since = "1.0.0")]
188+
#[allow(deprecated)]
186189
pub fn clear(&mut self) {
187190
let b = self.b;
188191
// avoid recursive destructors by manually traversing the tree

0 commit comments

Comments
 (0)