about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2015-05-04Auto merge of #25047 - sinkuu:vec_intoiter_override, r=alexcrichtonbors-0/+5
Override methods `count`, `last`, and `nth` in vec::IntoIter. #24214
2015-05-03Auto merge of #25064 - tshepang:brevity, r=alexcrichtonbors-10/+2
2015-05-03doc: make concat() and connect() examples briefTshepang Lekhonkhobe-10/+2
2015-05-02Override Iterator::count method in vec::IntoItersinkuu-0/+5
2015-05-02Auto merge of #25028 - bluss:drain-string, r=alexcrichtonbors-1/+107
collections: Implement String::drain(range) according to RFC 574 `.drain(range)` is unstable and under feature(collections_drain). This adds a safe way to remove any range of a String as efficiently as possible. As noted in the code, this drain iterator has none of the memory safety issues of the vector version. RFC tracking issue is #23055
2015-05-01Auto merge of #25006 - alexcrichton:unstable-indexing, r=aturonbors-14/+16
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791 [breaking-change]
2015-05-01collections: Implement String::drain(range) according to RFC 574Ulrik Sverdrup-1/+107
`.drain(range)` is unstable and under feature(collections_drain). This adds a safe way to remove any range of a String as efficiently as possible. As noted in the code, this drain iterator has none of the memory safety issues of the vector version. RFC tracking issue is #23055
2015-05-01std: Remove index notation on slice iteratorsAlex Crichton-14/+16
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791
2015-04-30Clarify intention wrt integersSteve Klabnik-1/+1
Fixes #24767
2015-04-28Register new snapshotsTamir Duberstein-13/+0
2015-04-28Auto merge of #24781 - bluss:vec-drain-range, r=alexcrichtonbors-81/+137
Implement Vec::drain(\<range type\>) from rust-lang/rfcs#574, tracking issue #23055. This is a big step forward for vector usability. This is an introduction of an API for removing a range of *m* consecutive elements from a vector, as efficently as possible. New features: - Introduce trait `std::collections::range::RangeArgument` implemented by all four built-in range types. - Change `Vec::drain()` to use `Vec::drain<R: RangeArgument>(R)` Implementation notes: - Use @Gankro's idea for memory safety: Use `set_len` on the source vector when creating the iterator, to make sure that the part of the vector that will be modified is unreachable. Fix up things in Drain's destructor — but even if it doesn't run, we don't expose any moved-out-from slots of the vector. - This `.drain<R>(R)` very close to how it is specified in the RFC. - Introduced as unstable - Drain reuses the slice iterator — copying and pasting the same iterator pointer arithmetic again felt very bad - The `usize` index as a range argument in the RFC is not included. The ranges trait would have to change to accomodate it. Please help me with: - Name and location of the new ranges trait. - Design of the ranges trait - Understanding Niko's comments about variance (Note: for a long time I was using a straight up &mut Vec in the iterator, but I changed this to permit reusing the slice iterator). Previous PR and discussion: #23071
2015-04-28collections: Implement vec::drain(range) according to RFC 574Ulrik Sverdrup-81/+91
Old `.drain()` on vec is performed using `.drain(..)` now. `.drain(range)` is unstable and under feature(collections_drain) [breaking-change]
2015-04-27collections: Add trait RangeArgumentUlrik Sverdrup-0/+46
RangeArgument is introduced as unstable under the feature(collections_range)
2015-04-27Rollup merge of #24868 - tshepang:fix-vec-remove-doc, r=steveklabnikSteve Klabnik-1/+1
2015-04-27Rollup merge of #24848 - bluss:deref-string, r=alexcrichtonSteve Klabnik-4/+21
Improve example for as_string and add example for as_vec Provide a better example of `as_string` / `DerefString`'s unique capabilities. Use an example where (for an unspecified reason) you need a &String, and show how `as_string` solves the problem without needing an allocation.
2015-04-27doc: it is 'index', not 'i'Tshepang Lekhonkhobe-1/+1
2015-04-27collections: Improve example for as_string and as_vecUlrik Sverdrup-4/+21
2015-04-26Utilize `while let` instead of `loop` with `break` in doc-commentCorey Farwell-5/+1
2015-04-25Auto merge of #24783 - jooert:unittestguidelines, r=alexcrichtonbors-2/+2
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest (see #23870, #24030 and http://users.rust-lang.org/t/guidelines-naming-of-unit-test-module/1078 for previous discussions). r? @alexcrichton
2015-04-24Whoops, please tidySteve Klabnik-9/+9
2015-04-24Add examples by @pnkfelix to fmt precisionSteve Klabnik-5/+62
Fixes #24656
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-2/+2
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.
2015-04-21Test fixes and rebase conflicts, round 1Alex Crichton-2/+1
2015-04-21rollup merge of #24636: alexcrichton/remove-deprecatedAlex Crichton-36/+6
Conflicts: src/libcore/result.rs
2015-04-21rollup merge of #24541: alexcrichton/issue-24538Alex Crichton-175/+133
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-21std: Bring back f32::from_str_radix as an unstable APIAlex Crichton-5/+4
This API was exercised in a few tests and mirrors the `from_str_radix` functionality of the integer types.
2015-04-21rollup merge of #24661: SimonSapin/fmt-write-charAlex Crichton-0/+6
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md). Note that this brand new method is marked as **stable**. I judged this safe enough: it’s simple enough that it’s very unlikely to change. Still, I can mark it unstable instead if you prefer. r? @alexcrichton
2015-04-21rollup merge of #24651: tamird/old-referencesAlex Crichton-2/+0
r? @alexcrichton
2015-04-21implement rfc 1054: split_whitespace() fn, deprecate words()kwantam-6/+23
For now, words() is left in (but deprecated), and Words is a type alias for struct SplitWhitespace. Also cleaned up references to s.words() throughout codebase. Closes #15628
2015-04-21unstabilize Words structkwantam-0/+1
Words struct was stabilied by mistake. Unstabilize.
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-8/+0
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-21std: Remove deprecated AsOsStr/Str/AsSlice traitsAlex Crichton-23/+2
Cleaning out more deprecated items
2015-04-21Remove references to `old_{path,io}`Tamir Duberstein-2/+0
2015-04-21Auto merge of #24620 - pczarn:model-lexer-issues, r=cmrbors-6/+0
Fixes #15679 Fixes #15878 Fixes #15882 Closes #15883
2015-04-21Add a `write_char` method to `std::fmt::Write`Simon Sapin-0/+6
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md).
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-6/+0
2015-04-20Update reference to old_io in fmt docsMatt Brubeck-1/+1
2015-04-19Auto merge of #24517 - erickt:str, r=alexcrichtonbors-1/+12
This implementation is currently about 3-4 times faster than using the `.to_string()` based approach. I would also suggest we deprecate `String::from_str` since it's redundant with the stable `String::from` method, but I'll leave that for a future PR.
2015-04-19collections: Move optimized String::from_str to String::fromErick Tryzelaar-1/+12
This implementation is currently about 3-4 times faster than using the `.to_string()` based approach.
2015-04-18Utilize if..let for get_mut doc-comment examplesCorey Farwell-14/+8
2015-04-18Auto merge of #24519 - rprichard:opt-write-args, r=alexcrichtonbors-1/+1
It's just as convenient, but it's much faster. Using write! requires an extra call to fmt::write and a extra dynamically dispatched call to Arguments' Display format function.
2015-04-17std: Add Default/IntoIterator/ToOwned to the preludeAlex Crichton-175/+133
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-16Call write_fmt directly to format an Arguments value.Ryan Prichard-1/+1
It's just as convenient, but it's much faster. Using write! requires an extra call to fmt::write and a extra dynamically dispatched call to Arguments' Display format function.
2015-04-16deprecate Unicode functions that will be moved to crates.iokwantam-12/+38
This patch 1. renames libunicode to librustc_unicode, 2. deprecates several pieces of libunicode (see below), and 3. removes references to deprecated functions from librustc_driver and libsyntax. This may change pretty-printed output from these modules in cases involving wide or combining characters used in filenames, identifiers, etc. The following functions are marked deprecated: 1. char.width() and str.width(): --> use unicode-width crate 2. str.graphemes() and str.grapheme_indices(): --> use unicode-segmentation crate 3. str.nfd_chars(), str.nfkd_chars(), str.nfc_chars(), str.nfkc_chars(), char.compose(), char.decompose_canonical(), char.decompose_compatible(), char.canonical_combining_class(): --> use unicode-normalization crate
2015-04-14Fill in missing implementationTamir Duberstein-0/+3
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-2/+2
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-14rollup merge of #24377: apasel422/docsAlex Crichton-26/+26
Conflicts: src/libstd/net/ip.rs src/libstd/sys/unix/fs.rs src/libstd/sys/unix/mod.rs src/libstd/sys/windows/mod.rs
2015-04-14rollup merge of #24310: alexcrichton/stabilize-utf8-errorAlex Crichton-10/+7
The meaning of each variant of this enum was somewhat ambiguous and it's uncler that we wouldn't even want to add more enumeration values in the future. As a result this error has been altered to instead become an opaque structure. Learning about the "first invalid byte index" is still an unstable feature, but the type itself is now stable.
2015-04-14test: Fixup many library unit testsAlex Crichton-2/+2