about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2016-01-04Feature-gate defaulted type parameters outside of types.Niko Matsakis-12/+12
2016-01-02Fix off-by-one in String::removediwic-3/+3
Obviously we can't remove the character one past the end of the String. And we can't today either - we'll just panic at char_at() instead - but if we're going to keep that assertion, we should at least have a correct assertion.
2015-12-31Make `LinkedList` and its read-only iterators covariantAndrew Paseltiner-7/+15
CC #30642
2015-12-26Fix some links in str docsFlorian Hartwig-3/+3
2015-12-23BinaryHeap: Use full sift down in .pop()Ulrik Sverdrup-1/+26
.sift_down can either choose to compare the element on the way down (and place it during descent), or to sift down an element fully, then sift back up to place it. A previous PR changed .sift_down() to the former behavior, which is much faster for relatively small heaps and for elements that are cheap to compare. A benchmarking run suggested that BinaryHeap::pop() suffers improportionally from this, and that it should use the second strategy instead. It's logical since .pop() brings last element from the heapified vector into index 0, it's very likely that this element will end up at the bottom again.
2015-12-21Register new snapshotsAlex Crichton-16/+4
Lots of cruft to remove!
2015-12-18Auto merge of #29973 - petrochenkov:privinpub, r=nikomatsakisbors-6/+6
Some notes: This patch enforces the rules from [RFC 136](https://github.com/rust-lang/rfcs/blob/master/text/0136-no-privates-in-public.md) and makes "private in public" a module-level concept and not crate-level. Only `pub` annotations are used by the new algorithm, crate-level exported node set produced by `EmbargoVisitor` is not used. The error messages are tweaked accordingly and don't use the word "exported" to avoid confusing people (https://github.com/rust-lang/rust/issues/29668). The old algorithm tried to be extra smart with impls, but it mostly led to unpredictable behavior and bugs like https://github.com/rust-lang/rust/issues/28325. The new algorithm tries to be as simple as possible - an impl is considered public iff its type is public and its trait is public (if presents). A type or trait is considered public if all its components are public, [complications](https://internals.rust-lang.org/t/limits-of-type-inference-smartness/2919) with private types leaking to other crates/modules through trait impls and type inference are deliberately ignored so far. The new algorithm is not recursive and uses the nice new facility `Crate::visit_all_items`! Obsolete pre-1.0 feature `visible_private_types` is removed. This is a [breaking-change]. The two main vectors of breakage are type aliases (https://github.com/rust-lang/rust/issues/28450) and impls (https://github.com/rust-lang/rust/issues/28325). I need some statistics from a crater run (cc @alexcrichton) to decide on the breakage mitigation strategy. UPDATE: All the new errors are reported as warnings controlled by a lint `private_in_public` and lint group `future_incompatible`, but the intent is to make them hard errors eventually. Closes https://github.com/rust-lang/rust/issues/28325 Closes https://github.com/rust-lang/rust/issues/28450 Closes https://github.com/rust-lang/rust/issues/29524 Closes https://github.com/rust-lang/rust/issues/29627 Closes https://github.com/rust-lang/rust/issues/29668 Closes https://github.com/rust-lang/rust/issues/30055 r? @nikomatsakis
2015-12-18Auto merge of #30272 - tshepang:doc-drain, r=blussbors-15/+26
Second sentence actually repeats info from first sentence. "from start to end" also feels like it adds nothing. I also extended Vec::drain example.
2015-12-18Fix the falloutVadim Petrochenkov-6/+6
2015-12-17Auto merge of #30445 - steveklabnik:rollup, r=steveklabnikbors-9/+0
- Successful merges: #30370, #30404, #30415, #30419, #30428, #30437, #30439, #30441, #30442, #30443 - Failed merges:
2015-12-17doc: improve drain examples and remove secondary info from leading paragraphTshepang Lekhonkhobe-15/+26
2015-12-17doc: no need to duplicate docs on renamed APITshepang Lekhonkhobe-9/+0
2015-12-17Remove unused importsJeffrey Seyfried-3/+3
2015-12-14Add links in BTreeSet docsOri Avtalion-3/+8
2015-12-14Auto merge of #30369 - jethrogb:patch-2, r=steveklabnikbors-8/+8
The old code returned `usize::MAX` as an error condition, which is not the Rust way.
2015-12-13Make BinaryHeap Dijkstra example return Optionjethrogb-8/+8
2015-12-13restore tests accidentally removed in #30182Tamir Duberstein-0/+3
2015-12-11Auto merge of #30308 - tsion:typo, r=sanxiynbors-2/+2
r? @steveklabnik
2015-12-10Improve documentation on String's methodsSteve Klabnik-94/+294
Part of #29376
2015-12-10Correct 'bye' to 'byte' in str docs.Scott Olson-2/+2
2015-12-10std: Remove deprecated functionality from 1.5Alex Crichton-84/+7
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-09doc: these are just renames, so avoid duplicationTshepang Lekhonkhobe-15/+1
2015-12-07Fix some str docs to refer to patternsWilliam Throwe-10/+13
2015-12-07Let str::replace take a patternWilliam Throwe-1/+1
It appears this was left out of RFC #528 because it might be useful to also generalize the second argument in some way. That doesn't seem to prevent generalizing the first argument now, however. This is a [breaking-change] because it could cause type-inference to fail where it previously succeeded.
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-46/+95
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * The `#![no_std]` attribute * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
2015-12-02Auto merge of #30146 - steveklabnik:doc_string_intro, r=brsonbors-4/+194
Part of #29376
2015-12-02Write better module-level and type-level docs for StringSteve Klabnik-4/+194
Part of #29376
2015-12-01Auto merge of #30124 - steveklabnik:doc_string_errors, r=alexcrichtonbors-8/+98
Part of #29376
2015-12-01Document the Error types in std::stringSteve Klabnik-8/+98
Part of #29376
2015-12-01Auto merge of #30057 - steveklabnik:doc_str, r=alexcrichtonbors-234/+579
Part of #29338
2015-11-30Rollup merge of #30120 - steveklabnik:doc_string_parse_error, r=alexcrichtonSteve Klabnik-1/+12
Part of #29376
2015-11-30Document std::string::ParseErrorSteve Klabnik-1/+12
Part of #29376
2015-11-30Better docs for the str primitiveSteve Klabnik-234/+579
Part of #29338
2015-11-30Write some docs for ToStringSteve Klabnik-2/+20
Part of #29376
2015-11-26Auto merge of #30015 - petrochenkov:staged, r=brsonbors-1/+1
Closes https://github.com/rust-lang/rust/issues/30008 `#[stable]`, `#[unstable]` and `#[rustc_deprecated]` are now guarded by `#[feature(staged_api)]` r? @brson
2015-11-25Auto merge of #30017 - nrc:fmt, r=brsonbors-982/+1426
2015-11-25Remove all uses of `#[staged_api]`Vadim Petrochenkov-1/+1
2015-11-24rustfmt libcollectionsNick Cameron-982/+1426
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-8/+10
2015-11-18Review fixesVadim Petrochenkov-1/+3
2015-11-18Add missing annotations and some testsVadim Petrochenkov-1/+56
2015-11-16Auto merge of #29830 - petrochenkov:mapdoc, r=alexcrichtonbors-2/+3
r? @steveklabnik
2015-11-14docs: Clarify insertion behavior for mapsVadim Petrochenkov-2/+3
2015-11-13Auto merge of #29811 - bluss:binary-heap-sift-less, r=gankrobors-7/+8
BinaryHeap: Simplify sift down Sift down was doing all too much work: it can stop directly when the current element obeys the heap property in relation to its children. In the old code, sift down didn't compare the element to sift down at all, so it was maximally sifted down and relied on the sift up call to put it in the correct location. This should speed up heapify and .pop(). Also rename Hole::removed() to Hole::element()
2015-11-13BinaryHeap: Simplify sift downUlrik Sverdrup-7/+8
Sift down was doing all too much work: it can stop directly when the current element obeys the heap property in relation to its children. In the old code, sift down didn't compare the element to sift down at all, so it was maximally sifted down and relied on the sift up call to put it in the correct location. This should speed up heapify and .pop(). Also rename Hole::removed() to Hole::element()
2015-11-13Auto merge of #29675 - bluss:merge-sort-fastpath, r=huonwbors-0/+12
sort: Fast path for already sorted data When merging two sorted blocks `left` and `right` if the last element in `left` is <= the first in `right`, the blocks are already in sorted order. Add this as an additional fast path by simply copying the whole left block into the output and advancing the left pointer. The right block is then treated the same way by the already present logic in the merge loop. Can reduce runtime of .sort() to less than 50% of the previous, if the data was already perfectly sorted. Sorted data with a few swaps are also sorted quicker than before. The overhead of one comparison per merge seems to be negligible.
2015-11-12libcollections: deny warnings in doctestsKevin Butler-8/+27
2015-11-08Fix outdated comment in Vec::from_iterStepan Koltsov-2/+1
Since commit 46068c9da, call to `reserve()` on empty vec allocates exactly requested capacity, so unroll of first iteration may help only with branch prediction.
2015-11-07sort: Guard the fast path by length checkUlrik Sverdrup-2/+4
The right part must not be empty.
2015-11-07sort: Fast path for already sorted dataUlrik Sverdrup-0/+10
When merging two sorted blocks `left` and `right` if the last element in `left` is <= the first in `right`, the blocks are already sorted. Add this as an additional fast path by simply copying the whole left block into the output and advancing the left pointer. The right block is then treated the same way by the already present logic in the merge loop. Reduces runtime of .sort() to less than 50% of the previous, if the data was already perfectly sorted. Sorted data with a few swaps are also sorted quicker than before. The overhead of one comparison per merge seems to be negligible.