about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
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
2015-09-03std: Account for CRLF in {str, BufRead}::linesAlex Crichton-4/+6
This commit is an implementation of [RFC 1212][rfc] which tweaks the behavior of the `str::lines` and `BufRead::lines` iterators. Both iterators now account for `\r\n` sequences in addition to `\n`, allowing for less surprising behavior across platforms (especially in the `BufRead` case). Splitting *only* on the `\n` character can still be achieved with `split('\n')` in both cases. The `str::lines_any` function is also now deprecated as `str::lines` is a drop-in replacement for it. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1212-line-endings.md Closes #28032
2015-09-03Use `null()`/`null_mut()` instead of `0 as *const T`/`0 as *mut T`Vadim Petrochenkov-2/+2
2015-09-02Auto merge of #28156 - nagisa:binaryheap-debug, r=Gankrobors-0/+8
r? @Gankro
2015-09-02Auto merge of #28148 - eefriedman:binary_heap, r=alexcrichtonbors-8/+23
2015-09-01Auto merge of #28146 - eefriedman:deque_extras, r=alexcrichtonbors-2/+8
2015-09-01Implement Debug for BinaryHeapSimonas Kazlauskas-0/+8
Fixes #28154
2015-09-01Add missing stability markings to BinaryHeap.Eli Friedman-8/+23
2015-08-31Add missing stability attributes to VecDeque.Eli Friedman-2/+8
2015-08-31hide docs for private `collections::btree::Recover` traitAndrew Paseltiner-0/+1
closes #28093
2015-08-29Auto merge of #28043 - apasel422:rfc-1194, r=alexcrichtonbors-9/+128
2015-08-28re-export debug builders in `std::fmt`Andrew Paseltiner-0/+1
2015-08-28implement RFC 1194Andrew Paseltiner-9/+128
2015-08-28Auto merge of #28038 - durka:grep-unstable-issue-refs, r=alexcrichtonbors-2/+3
After submitting #28031, I ran a [script](https://gist.github.com/durka/a5243440697c780f669b) on the rest of src/ and found some anomalies. In this PR are the fixes that I thought were obvious (but I might be wrong!). The others I've submitted in issue #28037.
2015-08-28Auto merge of #27956 - withoutboats:extend_string, r=alexcrichtonbors-6/+24
If you have an `Iterator<Item=String>` (say because those items were generated using `.to_string()` or similarly), borrow semantics do not permit you map that to an `Iterator<&'a str>`. These two implementations close a small gap in the `String` API. At the same time I've also made the names of the parameters to `String`'s `Extend` and `FromIterator` implementations consistent.
2015-08-27fix some more unstable issue annotationsAlex Burka-2/+3
2015-08-27Implemented Extend<String> and FromIterator<String> for String.Without Boats-6/+24
2015-08-27Auto merge of #27975 - sfackler:iter-order-methods, r=aturonbors-11/+11
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737 r? @alexcrichton
2015-08-26Make iter::order functions into methods on IteratorSteven Fackler-11/+11
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737
2015-08-27Auto merge of #27808 - SimonSapin:utf16decoder, r=alexcrichtonbors-120/+5
* Rename `Utf16Items` to `Utf16Decoder`. "Items" is meaningless. * Generalize it to any `u16` iterator, not just `[u16].iter()` * Make it yield `Result` instead of a custom `Utf16Item` enum that was isomorphic to `Result`. This enable using the `FromIterator for Result` impl. * Replace `Utf16Item::to_char_lossy` with a `Utf16Decoder::lossy` iterator adaptor. This is a [breaking change], but only for users of the unstable `rustc_unicode` crate. I’d like this functionality to be stabilized and re-exported in `std` eventually, as the "low-level equivalent" of `String::from_utf16` and `String::from_utf16_lossy` like #27784 is the low-level equivalent of #27714. CC @aturon, @alexcrichton
2015-08-25Simplify `String`’s `Extend<&str>` implementationChris Morgan-5/+1
Reserving lower_bound bytes was just silly. It’d be perfectly reasonable to have empty strings in the iterator, which could cause superfluous reallocation of the string, or to have more than one byte per string, which could cause additional reallocation (in practice it’ll balance out). The added complexity of this logic is simply pointless, adding a little bloat with no demonstrable advantage and slight disadvantage.
2015-08-23Refactor low-level UTF-16 decoding.Simon Sapin-10/+4
* Rename `utf16_items` to `decode_utf16`. "Items" is meaningless. * Move it to `rustc_unicode::char`, exposed in `std::char`. * Generalize it to any `u16` iterable, not just `&[u16]`. * Make it yield `Result` instead of a custom `Utf16Item` enum that was isomorphic to `Result`. This enable using the `FromIterator for Result` impl. * Add a `REPLACEMENT_CHARACTER` constant. * Document how `result.unwrap_or(REPLACEMENT_CHARACTER)` replaces `Utf16Item::to_char_lossy`.
2015-08-22Move the Borrow and BorrowMut traits to libcore.Simon Sapin-110/+1
2015-08-22Auto merge of #27860 - m4rw3r:rustdoc_unstable_feature_issue, r=alexcrichtonbors-0/+1
Implemented #27759 Example: ![screen shot 2015-08-16 at 21 45 17](https://cloud.githubusercontent.com/assets/108100/9295040/1fb24d50-4460-11e5-8ab8-81ac5330974a.png)
2015-08-18Auto merge of #27891 - steveklabnik:rollup, r=steveklabnikbors-1/+1
- Successful merges: #27881, #27882, #27883, #27884, #27888 - Failed merges:
2015-08-18Auto merge of #27624 - apasel422:issue-27620, r=Gankrobors-2/+23
Closes #27620.
2015-08-18Fixed example in documentationjotomicron-1/+1
Added the cost of the edge 3 -> 4 on the example in the module documentation
2015-08-16rustdoc: Added issue_tracker_base_url annotations to cratesMartin Wernstål-0/+1
2015-08-15collections: Add issues for unstable featuresAlex Crichton-65/+120
2015-08-14Auto merge of #27696 - bluss:into-boxed-str, r=alexcrichtonbors-1/+11
Rename String::into_boxed_slice -> into_boxed_str This is the name that was decided in rust-lang/rfcs#1152, and it's better if we say “boxed str” for `Box<str>`. The old name `String::into_boxed_slice` is deprecated.
2015-08-13Rename String::into_boxed_slice -> into_boxed_strUlrik Sverdrup-1/+11
This is the name that was decided in rust-lang/rfcs#1152, and it's better if we say “boxed str” for `Box<str>`. The old name `String::into_boxed_slice` is deprecated.
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-4557/+22
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-11rollup merge of #27678: alexcrichton/snapshotsAlex Crichton-38/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-11rollup merge of #27622: eefriedman/https-urlAlex Crichton-3/+3
Also fixes a few outdated links.
2015-08-11Register new snapshotsAlex Crichton-38/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-10Remove transmute from `btree::node::Node::as_slices_internal_mut`Andrew Paseltiner-2/+23
Closes #27620.
2015-08-09Use https URLs to refer to rust-lang.org where appropriate.Eli Friedman-3/+3
Also fixes a few outdated links.
2015-08-09Change TODO to FIXMETobias Bucher-1/+1
2015-08-09Make `str::as_bytes_mut` privateTobias Bucher-13/+0