about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2016-07-09make clone_from_slice consistent with copy_from_sliceAlexander Merritt-1/+1
What 'this slice' refers to is not intuitive (we're in the docs for Vec).
2016-07-09Improve slice docsGuillaume Gomez-9/+236
2016-07-08Remove useless doc comment for sliceGuillaume Gomez-1/+0
2016-07-06feat: reinterpret `precision` field for stringsEvgeny Safronov-2/+4
This commit changes the behavior of formatting string arguments with both width and precision fields set. Documentation says that the `width` field is the "minimum width" that the format should take up. If the value's string does not fill up this many characters, then the padding specified by fill/alignment will be used to take up the required space. This is true for all formatted types except string, which is truncated down to `precision` number of chars and then all of `fill`, `align` and `width` fields are completely ignored. For example: `format!("{:/^10.8}", "1234567890);` emits "12345678". In the contrast Python version works as the expected: ```python >>> '{:/^10.8}'.format('1234567890') '/12345678/' ``` This commit gives back the `Python` behavior by changing the `precision` field meaning to the truncation and nothing more. The result string *will* be prepended/appended up to the `width` field with the proper `fill` char. However, this is the breaking change. Also updated `std::fmt` docs about string precision. Signed-off-by: Evgeny Safronov <division494@gmail.com>
2016-07-03std: Stabilize APIs for the 1.11.0 releaseAlex Crichton-20/+5
Although the set of APIs being stabilized this release is relatively small, the trains keep going! Listed below are the APIs in the standard library which have either transitioned from unstable to stable or those from unstable to deprecated. Stable * `BTreeMap::{append, split_off}` * `BTreeSet::{append, split_off}` * `Cell::get_mut` * `RefCell::get_mut` * `BinaryHeap::append` * `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past libstd stabilizations * `Iterator::sum` * `Iterator::product` Deprecated * `{f32, f64}::next_after` * `{f32, f64}::integer_decode` * `{f32, f64}::ldexp` * `{f32, f64}::frexp` * `num::One` * `num::Zero` Added APIs (all unstable) * `iter::Sum` * `iter::Product` * `iter::Step` - a few methods were added to accomodate deprecation of One/Zero Removed APIs * `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is unstable Closes #27739 Closes #27752 Closes #32526 Closes #33444 Closes #34152 cc #34529 (new tracking issue)
2016-07-01Replace `LinkedList`'s use of `Box` with `Shared`Andrew Paseltiner-352/+283
Closes #34417
2016-06-30Rollup merge of #34547 - sanxiyn:pretty-lifetime, r=pnkfelixJeffrey Seyfried-0/+1
Fix pretty-printing of lifetime bound Fix #34527.
2016-06-29Rollup merge of #34305 - Aaronepower:master, r=alexcrichtonJeffrey Seyfried-0/+11
Added Default trait for Cow. Adds a default implementation for Cow. Which is the Owned's default.
2016-06-25Add example with leading zerosStefan Schindler-0/+1
2016-06-24Auto merge of #34425 - tbu-:pr_len_instead_of_size_hint, r=alexcrichtonbors-1/+1
Use `len` instead of `size_hint` where appropiate This makes it clearer that we're not just looking for a lower bound but rather know that the iterator is an `ExactSizeIterator`.
2016-06-24Auto merge of #34399 - alexcrichton:issue-audit, r=brsonbors-2/+1
std: Fix up stabilization discrepancies * Remove the deprecated `CharRange` type which was forgotten to be removed awhile back. * Stabilize the `os::$platform::raw::pthread_t` type which was intended to be stabilized as part of #32804
2016-06-23std: Fix up stabilization discrepanciesAlex Crichton-2/+1
* Remove the deprecated `CharRange` type which was forgotten to be removed awhile back. * Stabilize the `os::$platform::raw::pthread_t` type which was intended to be stabilized as part of #32804
2016-06-23Use `len` instead of `size_hint` where appropiateTobias Bucher-1/+1
This makes it clearer that we're not just looking for a lower bound but rather know that the iterator is an `ExactSizeIterator`.
2016-06-23Added Default trait for CowAaronepower-0/+11
2016-06-21implemented peek_mut and unit testsNathan Moos-0/+68
2016-06-17Add short summaries to btree modulesOliver Middleton-0/+2
Also improve hash_map and hash_set module short summaries.
2016-06-15Map::Entry::take() method to recover key and value togetherSean McArthur-0/+12
2016-06-10Update tracking issue for `{BTreeMap, BTreeSet}::{append, split_off}`Andrew Paseltiner-4/+4
2016-06-10Rollup merge of #34175 - rwz:patch-2, r=alexcrichtonSeo Sanghyeon-1/+1
Fix BTreeMap example typo The whole example is made around movies reviews, but that one line says "review some books".
2016-06-10Rollup merge of #34088 - srinivasreddy:rustfmt_map.rs, r=nrcSeo Sanghyeon-220/+274
run rustfmt on map.rs in libcollections/btree folder
2016-06-08Fix BTreeMap example typoPavel Pravosud-1/+1
The whole example is made around movies reviews, but that one line says "review some books".
2016-06-07Rollup merge of #33645 - withoutboats:woboats_trim_matches_doc, r=steveklabnikSteve Klabnik-2/+2
Correct the docs on str::trim_matches This pattern cannot be a str because str's pattern is not double-ended.
2016-06-05run rustfmt on map.rs in libcollections/btree folderSrinivas Reddy Thatiparthy-220/+274
2016-06-01Auto merge of #33947 - xosmig:btree_split_off, r=gereeterbors-92/+411
Implement split_off for BTreeMap and BTreeSet (RFC 509) Fixes #19986 and refactors common with append methods. It splits the tree with O(log n) operations and then calculates sizes by traversing the lower one. CC @gereeter
2016-06-01Auto merge of #33853 - alexcrichton:remove-deprecated, r=aturonbors-239/+0
std: Clean out old unstable + deprecated APIs These should all have been deprecated for at least one cycle, so this commit cleans them all out.
2016-06-01Rollup merge of #33606 - tshepang:future-talk, r=brsonManish Goregaokar-6/+3
doc: format! may or may not handle streams in future No need to talk about that here
2016-06-01Implement split_off for BTreeMap and BTreeSet (RFC 509)Andrey Tonkih-92/+411
2016-05-30std: Clean out old unstable + deprecated APIsAlex Crichton-239/+0
These should all have been deprecated for at least one cycle, so this commit cleans them all out.
2016-05-30Rollup merge of #33893 - Ophirr33:docs_string_split_fix, r=GuillaumeGomezManish Goregaokar-2/+28
Added examples/docs to split in str.rs Added documentation clarifying the behavior of split when used with the empty string and contiguous separators. Addresses issue [33882](https://github.com/rust-lang/rust/issues/33882). This is my first time contributing to rust, so forgive me if I'm skipping any of the contribution steps. Fixes #33882
2016-05-27Added examples/docs to split in str.rsTy Coghlan-2/+28
Added documentation clarifying the behavior of split when used with the empty string and contiguous separators.
2016-05-27Rollup merge of #33858 - liigo:patch-7, r=GuillaumeGomezGuillaume Gomez-1/+1
Point out the clone operation in summary line docs of `Vec::extend_from_slice`
2016-05-25Auto merge of #33699 - alexcrichton:stabilize-1.10, r=aturonbors-13/+10
std: Stabilize APIs for the 1.10 release This commit applies the FCP decisions made by the libs team for the 1.10 cycle, including both new stabilizations and deprecations. Specifically, the list of APIs is: Stabilized: * `os::windows::fs::OpenOptionsExt::access_mode` * `os::windows::fs::OpenOptionsExt::share_mode` * `os::windows::fs::OpenOptionsExt::custom_flags` * `os::windows::fs::OpenOptionsExt::attributes` * `os::windows::fs::OpenOptionsExt::security_qos_flags` * `os::unix::fs::OpenOptionsExt::custom_flags` * `sync::Weak::new` * `Default for sync::Weak` * `panic::set_hook` * `panic::take_hook` * `panic::PanicInfo` * `panic::PanicInfo::payload` * `panic::PanicInfo::location` * `panic::Location` * `panic::Location::file` * `panic::Location::line` * `ffi::CStr::from_bytes_with_nul` * `ffi::CStr::from_bytes_with_nul_unchecked` * `ffi::FromBytesWithNulError` * `fs::Metadata::modified` * `fs::Metadata::accessed` * `fs::Metadata::created` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weak` * `collections::{btree,hash}_map::{Occupied,Vacant,}Entry::key` * `os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}` * `SocketAddr::is_unnamed` * `SocketAddr::as_pathname` * `UnixStream::connect` * `UnixStream::pair` * `UnixStream::try_clone` * `UnixStream::local_addr` * `UnixStream::peer_addr` * `UnixStream::set_read_timeout` * `UnixStream::set_write_timeout` * `UnixStream::read_timeout` * `UnixStream::write_Timeout` * `UnixStream::set_nonblocking` * `UnixStream::take_error` * `UnixStream::shutdown` * Read/Write/RawFd impls for `UnixStream` * `UnixListener::bind` * `UnixListener::accept` * `UnixListener::try_clone` * `UnixListener::local_addr` * `UnixListener::set_nonblocking` * `UnixListener::take_error` * `UnixListener::incoming` * RawFd impls for `UnixListener` * `UnixDatagram::bind` * `UnixDatagram::unbound` * `UnixDatagram::pair` * `UnixDatagram::connect` * `UnixDatagram::try_clone` * `UnixDatagram::local_addr` * `UnixDatagram::peer_addr` * `UnixDatagram::recv_from` * `UnixDatagram::recv` * `UnixDatagram::send_to` * `UnixDatagram::send` * `UnixDatagram::set_read_timeout` * `UnixDatagram::set_write_timeout` * `UnixDatagram::read_timeout` * `UnixDatagram::write_timeout` * `UnixDatagram::set_nonblocking` * `UnixDatagram::take_error` * `UnixDatagram::shutdown` * RawFd impls for `UnixDatagram` * `{BTree,Hash}Map::values_mut` * `<[_]>::binary_search_by_key` Deprecated: * `StaticCondvar` - this, and all other static synchronization primitives below, are usable today through the lazy-static crate on stable Rust today. Additionally, we'd like the non-static versions to be directly usable in a static context one day, so they're unlikely to be the final forms of the APIs in any case. * `CONDVAR_INIT` * `StaticMutex` * `MUTEX_INIT` * `StaticRwLock` * `RWLOCK_INIT` * `iter::Peekable::is_empty` Closes #27717 Closes #27720 Closes #30014 Closes #30425 Closes #30449 Closes #31190 Closes #31399 Closes #31767 Closes #32111 Closes #32281 Closes #32312 Closes #32551 Closes #33018
2016-05-25Point out the clone operation in summary line docs of `Vec::extend_from_slice`Liigo Zhuang-1/+1
2016-05-24std: Stabilize APIs for the 1.10 releaseAlex Crichton-13/+10
This commit applies the FCP decisions made by the libs team for the 1.10 cycle, including both new stabilizations and deprecations. Specifically, the list of APIs is: Stabilized: * `os::windows::fs::OpenOptionsExt::access_mode` * `os::windows::fs::OpenOptionsExt::share_mode` * `os::windows::fs::OpenOptionsExt::custom_flags` * `os::windows::fs::OpenOptionsExt::attributes` * `os::windows::fs::OpenOptionsExt::security_qos_flags` * `os::unix::fs::OpenOptionsExt::custom_flags` * `sync::Weak::new` * `Default for sync::Weak` * `panic::set_hook` * `panic::take_hook` * `panic::PanicInfo` * `panic::PanicInfo::payload` * `panic::PanicInfo::location` * `panic::Location` * `panic::Location::file` * `panic::Location::line` * `ffi::CStr::from_bytes_with_nul` * `ffi::CStr::from_bytes_with_nul_unchecked` * `ffi::FromBytesWithNulError` * `fs::Metadata::modified` * `fs::Metadata::accessed` * `fs::Metadata::created` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weak` * `collections::{btree,hash}_map::{Occupied,Vacant,}Entry::key` * `os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}` * `SocketAddr::is_unnamed` * `SocketAddr::as_pathname` * `UnixStream::connect` * `UnixStream::pair` * `UnixStream::try_clone` * `UnixStream::local_addr` * `UnixStream::peer_addr` * `UnixStream::set_read_timeout` * `UnixStream::set_write_timeout` * `UnixStream::read_timeout` * `UnixStream::write_Timeout` * `UnixStream::set_nonblocking` * `UnixStream::take_error` * `UnixStream::shutdown` * Read/Write/RawFd impls for `UnixStream` * `UnixListener::bind` * `UnixListener::accept` * `UnixListener::try_clone` * `UnixListener::local_addr` * `UnixListener::set_nonblocking` * `UnixListener::take_error` * `UnixListener::incoming` * RawFd impls for `UnixListener` * `UnixDatagram::bind` * `UnixDatagram::unbound` * `UnixDatagram::pair` * `UnixDatagram::connect` * `UnixDatagram::try_clone` * `UnixDatagram::local_addr` * `UnixDatagram::peer_addr` * `UnixDatagram::recv_from` * `UnixDatagram::recv` * `UnixDatagram::send_to` * `UnixDatagram::send` * `UnixDatagram::set_read_timeout` * `UnixDatagram::set_write_timeout` * `UnixDatagram::read_timeout` * `UnixDatagram::write_timeout` * `UnixDatagram::set_nonblocking` * `UnixDatagram::take_error` * `UnixDatagram::shutdown` * RawFd impls for `UnixDatagram` * `{BTree,Hash}Map::values_mut` * `<[_]>::binary_search_by_key` Deprecated: * `StaticCondvar` - this, and all other static synchronization primitives below, are usable today through the lazy-static crate on stable Rust today. Additionally, we'd like the non-static versions to be directly usable in a static context one day, so they're unlikely to be the final forms of the APIs in any case. * `CONDVAR_INIT` * `StaticMutex` * `MUTEX_INIT` * `StaticRwLock` * `RWLOCK_INIT` * `iter::Peekable::is_empty` Closes #27717 Closes #27720 cc #27784 (but encode methods still exist) Closes #30014 Closes #30425 Closes #30449 Closes #31190 Closes #31399 Closes #31767 Closes #32111 Closes #32281 Closes #32312 Closes #32551 Closes #33018
2016-05-20Clarify docs for sort(&mut self)Stefan Schindler-7/+4
2016-05-16Rollup merge of #33635 - tshepang:capitalise, r=steveklabnikEduard-Mihai Burtescu-1/+1
doc: 'tis the lang, not the reptile
2016-05-16Rollup merge of #33634 - tshepang:nicer-output, r=steveklabnikEduard-Mihai Burtescu-1/+1
doc: improve output
2016-05-16Rollup merge of #33633 - tshepang:no-effect, r=steveklabnikEduard-Mihai Burtescu-2/+0
doc: this statement does not have an effect
2016-05-16Rollup merge of #33605 - tshepang:less-awkward, r=steveklabnikEduard-Mihai Burtescu-2/+2
doc: use less awkward and less confusing language
2016-05-16Rollup merge of #33604 - tshepang:line-em-up, r=GuillaumeGomezEduard-Mihai Burtescu-1/+1
doc: line these comments up Looks more nice, and same is done with prior examples
2016-05-16Rollup merge of #33603 - tshepang:no-need, r=apasel422Eduard-Mihai Burtescu-2/+2
doc: to_string not needed since we gots coercion
2016-05-15Rollup merge of #33598 - haikoschol:master, r=alexcrichtonManish Goregaokar-1/+1
doc: Fix comment in std::string::String example code
2016-05-14Correct the docs on str::trim_matchesWithout Boats-2/+2
This pattern cannot be a str because str's pattern is not double-ended.
2016-05-14doc: format! may or may not handle streams in futureTshepang Lekhonkhobe-6/+3
No need to talk about that here
2016-05-14doc: 'tis the lang, not the reptileTshepang Lekhonkhobe-1/+1
2016-05-14doc: improve outputTshepang Lekhonkhobe-1/+1
2016-05-14doc: this statement does not have an effectTshepang Lekhonkhobe-2/+0
2016-05-12doc: to_string not needed since we gots coercionTshepang Lekhonkhobe-2/+2
2016-05-12doc: use less awkward and less confusing languageTshepang Lekhonkhobe-2/+2
2016-05-12Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brsonbors-1/+4
rustbuild: Add support for crate tests + doctests This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc #31590