From: bors Date: Sun, 23 Apr 2017 02:13:55 +0000 (+0000) Subject: Auto merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcrichton X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=a94124488ae0dba1a8a4552a4724cddf9d266e2f;hp=-c;p=rust.git Auto merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcrichton Remove items that are unstable and deprecated This removes unstable items that have been deprecated for more than one cycle. - Since 1.16.0, `#![feature(enumset)]` - All of `mod collections::enum_set` - Since 1.15.0, `#![feature(borrow_state)]` - `cell::BorrowState` - `RefCell::borrow_state()` - Since 1.15.0, `#![feature(is_unique)]` - `Rc::is_unique()` (made private like `Arc::is_unique()`) - Since 1.15.0, `#![feature(rc_would_unwrap)]` - `Rc::would_wrap()` - Since 1.13.0, `#![feature(binary_heap_extras)]` - `BinaryHeap::push_pop()` - `BinaryHeap::replace()` - Since 1.12.0, `#![feature(as_unsafe_cell)]` - `Cell::as_unsafe_cell()` - `RefCell::as_unsafe_cell()` - Since 1.12.0, `#![feature(map_entry_recover_keys)]` - `btree_map::OccupiedEntry::remove_pair()` - `hash_map::OccupiedEntry::remove_pair()` - Since 1.11.0, `#![feature(float_extras)]` - `Float::nan()` - `Float::infinity()` - `Float::neg_infinity()` - `Float::neg_zero()` - `Float::zero()` - `Float::one()` - `Float::integer_decode()` - `f32::integer_decode()` - `f32::ldexp()` - `f32::frexp()` - `f32::next_after()` - `f64::integer_decode()` - `f64::ldexp()` - `f64::frexp()` - `f64::next_after()` - Since 1.11.0, `#![feature(zero_one)]` - `num::Zero` - `num::One` --- a94124488ae0dba1a8a4552a4724cddf9d266e2f diff --combined src/doc/unstable-book/src/SUMMARY.md index ee4e568a5ca,9fbd4e300f8..61347573041 --- a/src/doc/unstable-book/src/SUMMARY.md +++ b/src/doc/unstable-book/src/SUMMARY.md @@@ -72,7 -72,6 +72,7 @@@ - [proc_macro](language-features/proc-macro.md) - [quote](language-features/quote.md) - [relaxed_adts](language-features/relaxed-adts.md) + - [repr_align](language-features/repr-align.md) - [repr_simd](language-features/repr-simd.md) - [rustc_attrs](language-features/rustc-attrs.md) - [rustc_diagnostic_macros](language-features/rustc-diagnostic-macros.md) @@@ -102,11 -101,8 +102,8 @@@ - [alloc_system](library-features/alloc-system.md) - [alloc](library-features/alloc.md) - [as_c_str](library-features/as-c-str.md) - - [as_unsafe_cell](library-features/as-unsafe-cell.md) - [ascii_ctype](library-features/ascii-ctype.md) - - [binary_heap_extras](library-features/binary-heap-extras.md) - [binary_heap_peek_mut_pop](library-features/binary-heap-peek-mut-pop.md) - - [borrow_state](library-features/borrow-state.md) - [box_heap](library-features/box-heap.md) - [c_void_variant](library-features/c-void-variant.md) - [char_escape_debug](library-features/char-escape-debug.md) @@@ -131,14 -127,12 +128,12 @@@ - [derive_clone_copy](library-features/derive-clone-copy.md) - [derive_eq](library-features/derive-eq.md) - [discriminant_value](library-features/discriminant-value.md) - - [enumset](library-features/enumset.md) - [error_type_id](library-features/error-type-id.md) - [exact_size_is_empty](library-features/exact-size-is-empty.md) - [fd](library-features/fd.md) - [fd_read](library-features/fd-read.md) - [fixed_size_array](library-features/fixed-size-array.md) - [float_bits_conv](library-features/float-bits-conv.md) - - [float_extras](library-features/float-extras.md) - [flt2dec](library-features/flt2dec.md) - [fmt_flags_align](library-features/fmt-flags-align.md) - [fmt_internals](library-features/fmt-internals.md) @@@ -158,7 -152,6 +153,6 @@@ - [io_error_internals](library-features/io-error-internals.md) - [io](library-features/io.md) - [ip](library-features/ip.md) - - [is_unique](library-features/is-unique.md) - [iter_rfind](library-features/iter-rfind.md) - [libstd_io_internals](library-features/libstd-io-internals.md) - [libstd_sys_internals](library-features/libstd-sys-internals.md) @@@ -166,7 -159,6 +160,6 @@@ - [linked_list_extras](library-features/linked-list-extras.md) - [lookup_host](library-features/lookup-host.md) - [manually_drop](library-features/manually-drop.md) - - [map_entry_recover_keys](library-features/map-entry-recover-keys.md) - [mpsc_select](library-features/mpsc-select.md) - [n16](library-features/n16.md) - [never_type_impls](library-features/never-type-impls.md) @@@ -189,7 -181,6 +182,6 @@@ - [rand](library-features/rand.md) - [range_contains](library-features/range-contains.md) - [raw](library-features/raw.md) - - [rc_would_unwrap](library-features/rc-would-unwrap.md) - [retain_hash_collection](library-features/retain-hash-collection.md) - [reverse_cmp_key](library-features/reverse-cmp-key.md) - [rt](library-features/rt.md) @@@ -225,5 -216,3 +217,3 @@@ - [windows_handle](library-features/windows-handle.md) - [windows_net](library-features/windows-net.md) - [windows_stdio](library-features/windows-stdio.md) - - [zero_one](library-features/zero-one.md) - >>>>>> Add top level sections to the Unstable Book. diff --combined src/liballoc/rc.rs index 69e5351cad5,b12d89867c8..38dc9145835 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@@ -239,7 -239,7 +239,7 @@@ use core::ops::CoerceUnsized use core::ptr::{self, Shared}; use core::convert::From; -use heap::deallocate; +use heap::{allocate, deallocate, box_free}; use raw_vec::RawVec; struct RcBox { @@@ -248,6 -248,7 +248,6 @@@ value: T, } - /// A single-threaded reference-counting pointer. /// /// See the [module-level documentation](./index.html) for more details. @@@ -340,19 -341,6 +340,6 @@@ impl Rc } } - /// Checks whether [`Rc::try_unwrap`][try_unwrap] would return - /// [`Ok`]. - /// - /// [try_unwrap]: struct.Rc.html#method.try_unwrap - /// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok - #[unstable(feature = "rc_would_unwrap", - reason = "just added for niche usecase", - issue = "28356")] - #[rustc_deprecated(since = "1.15.0", reason = "too niche; use `strong_count` instead")] - pub fn would_unwrap(this: &Self) -> bool { - Rc::strong_count(&this) == 1 - } - /// Consumes the `Rc`, returning the wrapped pointer. /// /// To avoid a memory leak the pointer must be converted back to an `Rc` using @@@ -437,38 -425,6 +424,38 @@@ impl Rc } } +impl Rc<[T]> { + /// Constructs a new `Rc<[T]>` from a `Box<[T]>`. + #[doc(hidden)] + #[unstable(feature = "rustc_private", + reason = "for internal use in rustc", + issue = "0")] + pub fn __from_array(value: Box<[T]>) -> Rc<[T]> { + unsafe { + let ptr: *mut RcBox<[T]> = + mem::transmute([mem::align_of::>(), value.len()]); + // FIXME(custom-DST): creating this invalid &[T] is dubiously defined, + // we should have a better way of getting the size/align + // of a DST from its unsized part. + let ptr = allocate(size_of_val(&*ptr), align_of_val(&*ptr)); + let ptr: *mut RcBox<[T]> = mem::transmute([ptr as usize, value.len()]); + + // Initialize the new RcBox. + ptr::write(&mut (*ptr).strong, Cell::new(1)); + ptr::write(&mut (*ptr).weak, Cell::new(1)); + ptr::copy_nonoverlapping( + value.as_ptr(), + &mut (*ptr).value as *mut [T] as *mut T, + value.len()); + + // Free the original allocation without freeing its (moved) contents. + box_free(Box::into_raw(value)); + + Rc { ptr: Shared::new(ptr as *const _) } + } + } +} + impl Rc { /// Creates a new [`Weak`][weak] pointer to this value. /// @@@ -532,11 -488,7 +519,7 @@@ /// /// [weak]: struct.Weak.html #[inline] - #[unstable(feature = "is_unique", reason = "uniqueness has unclear meaning", - issue = "28356")] - #[rustc_deprecated(since = "1.15.0", - reason = "too niche; use `strong_count` and `weak_count` instead")] - pub fn is_unique(this: &Self) -> bool { + fn is_unique(this: &Self) -> bool { Rc::weak_count(this) == 0 && Rc::strong_count(this) == 1 } diff --combined src/libcollections/binary_heap.rs index b10a655c205,e61d5b31696..7d972403f65 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@@ -555,82 -555,6 +555,6 @@@ impl BinaryHeap self.sift_up(0, old_len); } - /// Pushes an item onto the binary heap, then pops the greatest item off the queue in - /// an optimized fashion. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// #![feature(binary_heap_extras)] - /// #![allow(deprecated)] - /// - /// use std::collections::BinaryHeap; - /// let mut heap = BinaryHeap::new(); - /// heap.push(1); - /// heap.push(5); - /// - /// assert_eq!(heap.push_pop(3), 5); - /// assert_eq!(heap.push_pop(9), 9); - /// assert_eq!(heap.len(), 2); - /// assert_eq!(heap.peek(), Some(&3)); - /// ``` - #[unstable(feature = "binary_heap_extras", - reason = "needs to be audited", - issue = "28147")] - #[rustc_deprecated(since = "1.13.0", reason = "use `peek_mut` instead")] - pub fn push_pop(&mut self, mut item: T) -> T { - match self.data.get_mut(0) { - None => return item, - Some(top) => { - if *top > item { - swap(&mut item, top); - } else { - return item; - } - } - } - - self.sift_down(0); - item - } - - /// Pops the greatest item off the binary heap, then pushes an item onto the queue in - /// an optimized fashion. The push is done regardless of whether the binary heap - /// was empty. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// #![feature(binary_heap_extras)] - /// #![allow(deprecated)] - /// - /// use std::collections::BinaryHeap; - /// let mut heap = BinaryHeap::new(); - /// - /// assert_eq!(heap.replace(1), None); - /// assert_eq!(heap.replace(3), Some(1)); - /// assert_eq!(heap.len(), 1); - /// assert_eq!(heap.peek(), Some(&3)); - /// ``` - #[unstable(feature = "binary_heap_extras", - reason = "needs to be audited", - issue = "28147")] - #[rustc_deprecated(since = "1.13.0", reason = "use `peek_mut` instead")] - pub fn replace(&mut self, mut item: T) -> Option { - if !self.is_empty() { - swap(&mut item, &mut self.data[0]); - self.sift_down(0); - Some(item) - } else { - self.push(item); - None - } - } - /// Consumes the `BinaryHeap` and returns the underlying vector /// in arbitrary order. /// @@@ -1042,7 -966,7 +966,7 @@@ impl<'a, T> FusedIterator for Iter<'a, /// An owning iterator over the elements of a `BinaryHeap`. /// -/// This `struct` is created by the [`into_iter`] method on [`BinaryHeap`] +/// This `struct` is created by the [`into_iter`] method on [`BinaryHeap`][`BinaryHeap`] /// (provided by the `IntoIterator` trait). See its documentation for more. /// /// [`into_iter`]: struct.BinaryHeap.html#method.into_iter diff --combined src/libcollections/btree/map.rs index c5e4c765252,885b97dda81..d73c0254a74 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@@ -298,7 -298,7 +298,7 @@@ pub struct IterMut<'a, K: 'a, V: 'a> /// An owning iterator over the entries of a `BTreeMap`. /// -/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`] +/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`][`BTreeMap`] /// (provided by the `IntoIterator` trait). See its documentation for more. /// /// [`into_iter`]: struct.BTreeMap.html#method.into_iter @@@ -2217,13 -2217,6 +2217,6 @@@ impl<'a, K: Ord, V> OccupiedEntry<'a, K self.handle.reborrow().into_kv().0 } - /// Deprecated, renamed to `remove_entry` - #[unstable(feature = "map_entry_recover_keys", issue = "34285")] - #[rustc_deprecated(since = "1.12.0", reason = "renamed to `remove_entry`")] - pub fn remove_pair(self) -> (K, V) { - self.remove_entry() - } - /// Take ownership of the key and value from the map. /// /// # Examples diff --combined src/libstd/collections/hash/map.rs index e7102115caf,c8732e68c85..51d127f8ba7 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@@ -1377,7 -1377,7 +1377,7 @@@ pub struct IterMut<'a, K: 'a, V: 'a> /// An owning iterator over the entries of a `HashMap`. /// -/// This `struct` is created by the [`into_iter`] method on [`HashMap`] +/// This `struct` is created by the [`into_iter`] method on [`HashMap`][`HashMap`] /// (provided by the `IntoIterator` trait). See its documentation for more. /// /// [`into_iter`]: struct.HashMap.html#method.into_iter @@@ -2017,13 -2017,6 +2017,6 @@@ impl<'a, K, V> OccupiedEntry<'a, K, V> self.elem.read().0 } - /// Deprecated, renamed to `remove_entry` - #[unstable(feature = "map_entry_recover_keys", issue = "34285")] - #[rustc_deprecated(since = "1.12.0", reason = "renamed to `remove_entry`")] - pub fn remove_pair(self) -> (K, V) { - self.remove_entry() - } - /// Take the ownership of the key and value from the map. /// /// # Examples