summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2015-10-25Auto merge of #29254 - alexcrichton:stabilize-1.5, r=brsonbors-90/+77
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
2015-10-25std: Stabilize library APIs for 1.5Alex Crichton-90/+77
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
2015-10-23Unsafety -> Safety in doc headingsSteve Klabnik-4/+4
Follow https://doc.rust-lang.org/book/documentation.html#special-sections
2015-10-23Auto merge of #27894 - steveklabnik:gh26888, r=alexcrichtonbors-4/+16
{BTree,Hash}{Map,Set} will not update their key if it already exists, which can matter with more complex keys. This behavior is now documented. Fixes #26888
2015-10-22Document replacement behavior in some collectionsSteve Klabnik-4/+16
{BTree,Hash}{Map,Set} will not update their key if it already exists, which can matter with more complex keys. This behavior is now documented. Fixes #26888
2015-10-21Auto merge of #29186 - pnkfelix:fsk-fix-issue-29166, r=alexcrichtonbors-0/+1
Add dropck unsafe escape hatch (UGEH) to vec::IntoIter. Fix #29166
2015-10-20Add dropck unsafe escape hatch (UGEH) to vec::IntoIter.Felix S. Klock II-0/+1
Fix #29166
2015-10-20Auto merge of #27723 - mystor:vecdeque_drain_range, r=blussbors-14/+274
This is a WIP PR for my implementation of drain over the VecDeque data structure supporting ranges. It brings the VecDeque drain implementation in line with Vec's. Tests haven't been written for the new function yet.
2015-10-19Correct spelling in docsAndrew Paseltiner-1/+1
2015-10-13Correct spelling in docsAndrew Paseltiner-2/+2
2015-10-10Trivial typo fix: from_utrf8 should be from_utf8Andrew Chin-1/+1
2015-10-10Auto merge of #28861 - pnkfelix:fsk-nonparam-dropck-issue28498, r=arielb1bors-0/+12
implement RFC 1238: nonparametric dropck. cc #28498 cc @nikomatsakis
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-1/+1
2015-10-08Add unsafe Send and Sync impls to VecDeque's Drain<T>Michael Layzell-0/+3
2015-10-07doc: Mention split_whitespace in split docBoris Egorov-0/+4
2015-10-06Add RFC 1238's `unsafe_destructor_blind_to_params` (UGEH) where needed.Felix S. Klock II-0/+12
I needed it in `RawVec`, `Vec`, and `TypedArena` for `rustc` to bootstrap; but of course that alone was not sufficient for `make check`. Later I added `unsafe_destructor_blind_to_params` to collections, in particular `LinkedList` and `RawTable` (the backing representation for `HashMap` and `HashSet`), to get the regression tests exercising cyclic structure from PR #27185 building. ---- Note that the feature is `dropck_parametricity` (which is not the same as the attribute's name). We will almost certainly vary our strategy here in the future, so it makes some sense to have a not-as-ugly name for the feature gate. (The attribute name was deliberately selected to be ugly looking.)
2015-10-02Improve documentation for the from_utf8 familySteve Klabnik-18/+111
Our docs were very basic for the various versions of from_utf8, so this commit beefs them up. It also improves docs for the &str variant's error, Utf8Error.
2015-10-01fixup wordingAlexis Beingessner-1/+1
2015-10-01flesh out what Vec actually guaranteesAlexis Beingessner-0/+75
2015-09-30Format panic docs for split_atSteve Klabnik-0/+2
Fixes #28384
2015-09-30Auto merge of #28731 - bluss:by-ref, r=alexcrichtonbors-2/+2
Remove redundant uses of Iterator::by_ref()
2015-09-29Remove redundant uses of Iterator::by_ref()Ulrik Sverdrup-2/+2
2015-09-28Use code formatting for code-relevant values in std::fmt docsCarol (Nichols || Goulding)-13/+13
Especially when documenting the use of `0`, since zero looks very similar to `O` in fonts not meant for displaying code. Other literal characters, traits, etc should also use code formatting. This change makes this documentation more internally consistent.
2015-09-27Auto merge of #28689 - Manishearth:rollup, r=Manishearthbors-26/+2
- Successful merges: #28664, #28673, #28681, #28682, #28688 - Failed merges:
2015-09-27Rollup merge of #28682 - apasel422:features, r=steveklabnikManish Goregaokar-8/+0
2015-09-27Rollup merge of #28664 - apasel422:collections-debug, r=alexcrichtonManish Goregaokar-18/+2
2015-09-27Auto merge of #28663 - bluss:vec-as-mut, r=alexcrichtonbors-0/+14
Implement AsMut for Vec Fixes #28549
2015-09-26Auto merge of #28635 - alexcrichton:str-parse-error-void, r=aturonbors-2/+22
It can never be instantiated, so signify this by having it actually be an empty `enum`. cc #27734
2015-09-26Auto merge of #28632 - alexcrichton:update-match-indices, r=Kimundibors-42/+30
This commit updates the `MatchIndices` and `RMatchIndices` iterators to follow the same pattern as the `chars` and `char_indices` iterators. The `matches` iterator currently yield `&str` elements, so the `MatchIndices` iterator now yields the index of the match as well as the `&str` that matched (instead of start/end indexes). cc #27743
2015-09-26Remove unnecessary `#![feature]` attributesAndrew Paseltiner-8/+0
2015-09-25Add AsMut<Vec<T>> for Vec<T>Ulrik Sverdrup-0/+7
2015-09-25std: Update MatchIndices to return a subsliceAlex Crichton-42/+30
This commit updates the `MatchIndices` and `RMatchIndices` iterators to follow the same pattern as the `chars` and `char_indices` iterators. The `matches` iterator currently yield `&str` elements, so the `MatchIndices` iterator now yields the index of the match as well as the `&str` that matched (instead of start/end indexes). cc #27743
2015-09-25Simplify `Debug` for `{EnumSet, VecDeque}`Andrew Paseltiner-18/+2
2015-09-25Implement AsMut for VecUlrik Sverdrup-0/+7
Fixes #28549
2015-09-24std: Switch string::ParseError to an empty enumAlex Crichton-2/+22
It can never be instantiated, so signify this by having it actually be an empty `enum`. cc #27734
2015-09-24Auto merge of #28602 - apasel422:clone_from, r=blussbors-11/+28
r? @bluss
2015-09-24Optimize `Vec::clone_from`Andrew Paseltiner-9/+5
Before: test dst_bigger::src_100_dst_1000::clone ... bench: 34 ns/iter (+/- 1) test dst_bigger::src_100_dst_1000::clone_from ... bench: 75 ns/iter (+/- 3) test dst_bigger::src_10_dst_100::clone ... bench: 25 ns/iter (+/- 0) test dst_bigger::src_10_dst_100::clone_from ... bench: 9 ns/iter (+/- 1) test eq::src_1000_dst_1000::clone ... bench: 105 ns/iter (+/- 2) test eq::src_1000_dst_1000::clone_from ... bench: 593 ns/iter (+/- 21) test eq::src_100_dst_100::clone ... bench: 34 ns/iter (+/- 1) test eq::src_100_dst_100::clone_from ... bench: 75 ns/iter (+/- 1) test src_bigger::src_1000_dst_100::clone ... bench: 103 ns/iter (+/- 5) test src_bigger::src_1000_dst_100::clone_from ... bench: 148 ns/iter (+/- 5) test src_bigger::src_100_dst_10::clone ... bench: 34 ns/iter (+/- 1) test src_bigger::src_100_dst_10::clone_from ... bench: 20 ns/iter (+/- 0) After: test dst_bigger::src_100_dst_1000::clone ... bench: 34 ns/iter (+/- 2) test dst_bigger::src_100_dst_1000::clone_from ... bench: 15 ns/iter (+/- 1) test dst_bigger::src_10_dst_100::clone ... bench: 26 ns/iter (+/- 1) test dst_bigger::src_10_dst_100::clone_from ... bench: 7 ns/iter (+/- 0) test eq::src_1000_dst_1000::clone ... bench: 103 ns/iter (+/- 1) test eq::src_1000_dst_1000::clone_from ... bench: 85 ns/iter (+/- 4) test eq::src_100_dst_100::clone ... bench: 34 ns/iter (+/- 2) test eq::src_100_dst_100::clone_from ... bench: 15 ns/iter (+/- 1) test src_bigger::src_1000_dst_100::clone ... bench: 103 ns/iter (+/- 4) test src_bigger::src_1000_dst_100::clone_from ... bench: 90 ns/iter (+/- 2) test src_bigger::src_100_dst_10::clone ... bench: 34 ns/iter (+/- 2) test src_bigger::src_100_dst_10::clone_from ... bench: 20 ns/iter (+/- 0) Closes #28601.
2015-09-23Fix bad copypasta for patterns doc in std::strRemi Rampin-12/+9
2015-09-23Override `clone_from` for `{BinaryHeap, String}`Andrew Paseltiner-2/+23
CC #28481
2015-09-22Implement drain over a range for VecDequeMichael Layzell-14/+271
2015-09-22Auto merge of #28364 - petrochenkov:usegate, r=alexcrichtonbors-0/+5
Closes https://github.com/rust-lang/rust/issues/28075 Closes https://github.com/rust-lang/rust/issues/28388 r? @eddyb cc @brson
2015-09-20Add comment.whitequark-0/+2
2015-09-20Fix style.whitequark-3/+5
2015-09-20Do not drop_in_place elements of Vec<T> if T doesn't need droppingwhitequark-3/+5
With -O2, LLVM's inliner can remove this code, but this does not happen with -O1 and lower. As a result, dropping Vec<u8> was linear with length, resulting in abysmal performance for large buffers.
2015-09-19Auto merge of #28497 - apasel422:issue-28493, r=Gankrobors-1/+6
When both the key and value types were zero-sized, `BTreeMap` previously called `heap::allocate` with `size == 0` for leaf nodes, which is undefined behavior, and jemalloc would attempt to read invalid memory, crashing the process. This avoids undefined behavior by allocating enough space to store one edge in leaf nodes that would otherwise have `size == 0`. Although this uses extra memory, maps with zero-sized key types that have sensible implementations of the ordering traits can only contain a single key-value pair (and therefore only a single leaf node), and maps with key and value types that are both zero-sized have few uses, if any. Furthermore, this is a temporary fix that will likely be unnecessary once the `BTreeMap` implementation is rewritten to use parent pointers. Closes #28493.
2015-09-19VecDeque: Use power of two capacity even for zero sized typesUlrik Sverdrup-1/+40
VecDeque depends on using a power of two capacity. Use the largest possible power of two capacity for ZSTs.
2015-09-18Avoid zero-sized leaf allocations in `BTreeMap`Andrew Paseltiner-1/+6
When both the key and value types were zero-sized, `BTreeMap` previously called `heap::allocate` with `size == 0` for leaf nodes, which is undefined behavior, and jemalloc would attempt to read invalid memory, crashing the process. This avoids undefined behavior by allocating enough space to store one edge in leaf nodes that would otherwise have `size == 0`. Although this uses extra memory, maps with zero-sized key types that have sensible implementations of the ordering traits can only contain a single key-value pair (and therefore only a single leaf node), and maps with key and value types that are both zero-sized have few uses, if any. Furthermore, this is a temporary fix that will likely be unnecessary once the `BTreeMap` implementation is rewritten to use parent pointers. Closes #28493.
2015-09-17Correctly walk import lists in AST visitorsVadim Petrochenkov-0/+5
2015-09-11std: Stabilize/deprecate features for 1.4Alex Crichton-30/+15
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 #27277 Closes #27718 Closes #27736 Closes #27764 Closes #27765 Closes #27766 Closes #27767 Closes #27768 Closes #27769 Closes #27771 Closes #27773 Closes #27775 Closes #27776 Closes #27785 Closes #27792 Closes #27795 Closes #27797
2015-09-07Add note about clone in docs for vec![]Manish Goregaokar-0/+6