about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2016-02-09Minor spelling fixesCarlos E. Garcia-3/+3
2016-02-09Auto merge of #31492 - alexcrichton:remove-allow-trivial-casts, r=nrcbors-1/+0
These were added a long time ago but we long since switched the lint back to allow-by-default, so these annotations shouldn't be necessary.
2016-02-08Fix up docs for String::from_utf8_lossy()Steve Klabnik-11/+12
When I last did a pass through the string documentation, I focused on consistency across similar functions. Unfortunately, I missed some details. This example was _too_ consistent: it wasn't actually accurate! This commit fixes the docs do both be more accurate and to explain why the return type is a Cow<'a, str>. First reported here: https://www.reddit.com/r/rust/comments/44q9ms/stringfrom_utf8_lossy_doesnt_return_a_string/
2016-02-08Remove old #[allow(trivial_casts)] annotationsAlex Crichton-1/+0
These were added a long time ago but we long since switched the lint back to allow-by-default, so these annotations shouldn't be necessary.
2016-02-05Start documenting BTreeMap's node interfaceJonathan S-3/+149
2016-02-05Auto merge of #31386 - tbu-:pr_cow_from_vec, r=alexcrichtonbors-0/+14
Fixes #31354.
2016-02-03Add `Cow::from` for `Vec` and slicesTobias Bucher-0/+14
Fixes #31354.
2016-02-02Correct `linked_list::IntoIter` doc commentAndrew Paseltiner-1/+1
2016-02-02Rollup merge of #31345 - kamalmarhubi:book-docs-special-section-errors, ↵Steve Klabnik-2/+2
r=steveklabnik This matches the usage in the standard library's documentation.
2016-02-02Rollup merge of #31202 - steveklabnik:gh30459, r=alexcrichtonSteve Klabnik-0/+48
Fixes #30459 Fun fact: i wanted to write "Arabic" and "Hebrew" in Arabic and Hebrew, but vim kept doing the copy/paste in the wrong direction.
2016-02-02Add doctests for directionalitySteve Klabnik-0/+20
Thanks @nodakai
2016-02-01docs: Standardize on 'Errors' header in std docsKamal Marhubi-2/+2
2016-01-29std::string::String.from_utf16 doc fixtgor-1/+1
2016-01-28Auto merge of #31225 - mbrubeck:btreeset-size-hint, r=Gankrobors-2/+27
None
2016-01-27Auto merge of #31224 - bluss:deque-hashing, r=Gankrobors-3/+3
Hash VecDeque in its slice parts Use .as_slices() for a more efficient code path in VecDeque's Hash impl. This still hashes the elements in the same order. Before/after timing of VecDeque hashing 1024 elements of u8 and u64 shows that the vecdeque now can match the Vec (test_hashing_vec_of_u64 is the Vec run). ``` before test test_hashing_u64 ... bench: 14,031 ns/iter (+/- 236) = 583 MB/s test test_hashing_u8 ... bench: 7,887 ns/iter (+/- 65) = 129 MB/s test test_hashing_vec_of_u64 ... bench: 6,578 ns/iter (+/- 76) = 1245 MB/s after running 5 tests test test_hashing_u64 ... bench: 6,495 ns/iter (+/- 52) = 1261 MB/s test test_hashing_u8 ... bench: 851 ns/iter (+/- 16) = 1203 MB/s test test_hashing_vec_of_u64 ... bench: 6,499 ns/iter (+/- 59) = 1260 MB/s ```
2016-01-27collections: Use slices parts in PartialEq for VecDequeUlrik Sverdrup-1/+33
This improves == for VecDeque by using the slice representation. This will also improve further if codegen for slice comparison improves. Benchmark run of 1000 u64 elements, comparing for equality (all equal). Cpu time to compare the vecdeques is reduced to less than 50% of what it was before. ``` test test_eq_u64 ... bench: 1,885 ns/iter (+/- 163) = 4244 MB/s test test_eq_new_u64 ... bench: 802 ns/iter (+/- 100) = 9975 MB/s ```
2016-01-27collections: Hash VecDeque in its slice partsUlrik Sverdrup-3/+3
Use .as_slices() for a more efficient code path in VecDeque's Hash impl. This still hashes the elements in the same order. Before/after timing of VecDeque hashing 1024 elements of u8 and u64 shows that the vecdeque now can match the Vec (test_hashing_vec_of_u64 is the Vec run). before test test_hashing_u64 ... bench: 14,031 ns/iter (+/- 236) = 583 MB/s test test_hashing_u8 ... bench: 7,887 ns/iter (+/- 65) = 129 MB/s test test_hashing_vec_of_u64 ... bench: 6,578 ns/iter (+/- 76) = 1245 MB/s after running 5 tests test test_hashing_u64 ... bench: 6,495 ns/iter (+/- 52) = 1261 MB/s test test_hashing_u8 ... bench: 851 ns/iter (+/- 16) = 1203 MB/s test test_hashing_vec_of_u64 ... bench: 6,499 ns/iter (+/- 59) = 1260 MB/s
2016-01-26Add size hints for BTreeSet iteratorsMatt Brubeck-2/+27
2016-01-26Fix warnings during testsAlex Crichton-18/+3
The deny(warnings) attribute is now enabled for tests so we need to weed out these warnings as well.
2016-01-26Document LTR vs RTL wrt trim_*Steve Klabnik-0/+28
The doc part of #30459
2016-01-24mk: Move from `-D warnings` to `#![deny(warnings)]`Alex Crichton-0/+1
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-23Rollup merge of #31136 - mbrubeck:btree-doc, r=steveklabnikSteve Klabnik-10/+10
Also change the examples to make this more obvious. Fixes #31129.
2016-01-22Document that BTreeMap iteration is in orderMatt Brubeck-10/+10
Also change the examples to make this more obvious. Fixes #31129.
2016-01-22Implement error::Error and fmt::Display for string::ParseErrorDirk Gadsden-0/+7
Fixes #31106.
2016-01-20Auto merge of #31038 - gereeter:btree-panic, r=Gankrobors-2/+2
…ving elements into it. Fixes #31029.
2016-01-19In BTreeMap's merge function, adjust the length of the node before moving ↵Jonathan S-2/+2
elements into it.
2016-01-19Rollup merge of #31008 - barosl:typo, r=blussManish Goregaokar-2/+2
2016-01-19Rollup merge of #30998 - apasel422:btree-set-variance, r=GankroManish Goregaokar-19/+9
CC #30642 r? @Gankro
2016-01-19Rollup merge of #30981 - boblehest:tmp, r=alexcrichtonManish Goregaokar-2/+2
Original: #30968 (My first PR was targeting the wrong branch)
2016-01-19Fix typoBarosl Lee-2/+2
2016-01-18Auto merge of #30956 - KiChjang:move-tests-to-libcollectionstest, r=blussbors-30/+0
Encountered while I was trying to work on #28518. Please let me know whether this is a correct move.
2016-01-18Make `btree_set::{IntoIter, Iter, Range}` covariantAndrew Paseltiner-19/+9
CC #30642
2016-01-17Fix and test variance of BTreeMap and its companion structs.Jonathan S-17/+39
2016-01-17Move zst test from libcollections to src/testKeith Yeung-30/+0
2016-01-17Rollup merge of #30943 - alexcrichton:stabilize-1.7, r=aturonManish Goregaokar-33/+43
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2016-01-16Rewrite BTreeMap to use parent pointers.Jonathan S-2593/+1882
2016-01-17Fix typo in std::fmt docsJørn Lode-2/+2
2016-01-16std: Stabilize APIs for the 1.7 releaseAlex Crichton-33/+43
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_neg` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2016-01-16Auto merge of #30939 - shepmaster:btreeset-insert-return-value, r=alexcrichtonbors-1/+1
2016-01-15BTreeSet::insert returns false when key already existsJake Goulding-1/+1
2016-01-15Auto merge of #30898 - petrochenkov:tvarfstab, r=alexcrichtonbors-4/+10
This wasn't done in https://github.com/rust-lang/rust/pull/29083 because attributes weren't parsed on fields of tuple variant back then. r? @alexcrichton
2016-01-14Require stability annotations on fields of tuple variantsVadim Petrochenkov-4/+10
2016-01-14Rollup merge of #30886 - ollie27:docs_links, r=steveklabnikManish Goregaokar-6/+9
r? @steveklabnik
2016-01-14Rollup merge of #30879 - durka:collections-range-tracking-issue, r=nagisaManish Goregaokar-2/+3
see #27711 and #30877 r? @alexcrichton
2016-01-14Rollup merge of #30770 - steveklabnik:gh30345, r=brsonManish Goregaokar-0/+36
Fixes #30345 I'm not sure if there's anything else that belongs here. Thoughts?
2016-01-13Fix some broken and missing links in the docsOliver Middleton-6/+9
2016-01-13update tracking issue for collections_rangeAlex Burka-2/+3
2016-01-13Auto merge of #29498 - wthrowe:replace-pattern, r=alexcrichtonbors-11/+14
It appears this was left out of RFC rust-lang/rfcs#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. Also update docs for a few other methods that still referred to `&str` instead of patterns.
2016-01-12Add some examples to std::stringSteve Klabnik-0/+36
Fixes #30345
2016-01-11Auto merge of #30534 - bluss:binary-heap-fast-pop, r=Gankrobors-1/+26
BinaryHeap: Use full sift down in .pop() .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. Closes #29969 Previous PR #29811