summary refs log tree commit diff
path: root/src/libcollectionstest
AgeCommit message (Collapse)AuthorLines
2015-07-29implement Clone for Box<str>, closes #27323Alexis Beingessner-0/+8
This is a minor [breaking-change], as it changes what `boxed_str.to_owned()` does (previously it would deref to `&str` and call `to_owned` on that to get a `String`). However `Box<str>` is such an exceptionally rare type that this is not expected to be a serious concern. Also a `Box<str>` can be freely converted to a `String` to obtain the previous behaviour anyway.
2015-07-28Implement Clone for Box<[T]> where T: CloneJonathan Reem-0/+53
Closes #25097
2015-07-17Add RawVec to unify raw Vecish codeAlexis Beingessner-30/+0
2015-07-13Auto merge of #26241 - SimonSapin:derefmut-for-string, r=alexcrichtonbors-0/+14
See https://github.com/rust-lang/rfcs/issues/1157
2015-07-13Fix tests for changes in #26241.Simon Sapin-0/+1
2015-07-13Add str::split_at_mutSimon Sapin-0/+13
2015-07-12Auto merge of #26957 - wesleywiser:rename_connect_to_join, r=alexcrichtonbors-25/+25
Fixes #26900
2015-07-12Auto merge of #26966 - nagisa:tail-init, r=alexcrichtonbors-42/+20
Fixes #26906
2015-07-11Add String::into_boxed_slice and Box<str>::into_stringJonathan Reem-0/+16
Implements merged RFC 1152. Closes #26697.
2015-07-12Implement RFC 1058Simonas Kazlauskas-42/+20
2015-07-10Change some instances of .connect() to .join()Wesley Wiser-25/+25
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-4/+4
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)
2015-06-30Auto merge of #26327 - bluss:two-way, r=aturonbors-1/+9
Update substring search to use the Two Way algorithm To improve our substring search performance, revive the two way searcher and adapt it to the Pattern API. Fixes #25483, a performance bug: that particular case now completes faster in optimized rust than in ruby (but they share the same order of magnitude). Many thanks to @gereeter who helped me understand the reverse case better and wrote the comment explaining `next_back` in the code. I had quickcheck to fuzz test forward and reverse searching thoroughly. The two way searcher implements both forward and reverse search, but not double ended search. The forward and reverse parts of the two way searcher are completely independent. The two way searcher algorithm has very small, constant space overhead, requiring no dynamic allocation. Our implementation is relatively fast, especially due to the `byteset` addition to the algorithm, which speeds up many no-match cases. A bad case for the two way algorithm is: ``` let haystack = (0..10_000).map(|_| "dac").collect::<String>(); let needle = (0..100).map(|_| "bac").collect::<String>()); ``` For this particular case, two way is not much faster than the naive implementation it replaces.
2015-06-24Remove remaining use of `bit_vec_append_splitoff` feature gate.Johannes Oertel-1/+0
2015-06-21StrSearcher: Update substring search to use the Two Way algorithmUlrik Sverdrup-1/+9
To improve our substring search performance, revive the two way searcher and adapt it to the Pattern API. Fixes #25483, a performance bug: that particular case now completes faster in optimized rust than in ruby (but they share the same order of magnitude). Much thanks to @gereeter who helped me understand the reverse case better and wrote the comment explaining `next_back` in the code. I had quickcheck to fuzz test forward and reverse searching thoroughly. The two way searcher implements both forward and reverse search, but not double ended search. The forward and reverse parts of the two way searcher are completely independent. The two way searcher algorithm has very small, constant space overhead, requiring no dynamic allocation. Our implementation is relatively fast, especially due to the `byteset` addition to the algorithm, which speeds up many no-match cases. A bad case for the two way algorithm is: ``` let haystack = (0..10_000).map(|_| "dac").collect::<String>(); let needle = (0..100).map(|_| "bac").collect::<String>()); ``` For this particular case, two way is not much faster than the naive implementation it replaces.
2015-06-17More test fixes and fallout of stability changesAlex Crichton-1/+1
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-12/+44
2015-06-11Auto merge of #26190 - Veedrac:no-iter, r=alexcrichtonbors-6/+6
Pull request for #26188.
2015-06-11Auto merge of #26122 - bluss:borrow-box, r=alexcrichtonbors-0/+29
Implement Borrow<T> and BorrowMut<T> for Box<T: ?Sized>
2015-06-11Auto merge of #25839 - bluss:str-split-at-impl, r=alexcrichtonbors-0/+20
Implement RFC rust-lang/rfcs#1123 Add str method str::split_at(mid: usize) -> (&str, &str). Also a minor cleanup in the collections::str module. Remove redundant slicing of self.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-6/+6
2015-06-10Add str::split_atUlrik Sverdrup-0/+20
Implement RFC rust-lang/rfcs#1123 Add str method str::split_at(mid: usize) -> (&str, &str).
2015-06-09Auto merge of #26039 - SimonSapin:case-mapping, r=alexcrichtonbors-0/+39
* Add “complex” mappings to `char::to_lowercase` and `char::to_uppercase`, making them yield sometimes more than on `char`: #25800. `str::to_lowercase` and `str::to_uppercase` are affected as well. * Add `char::to_titlecase`, since it’s the same algorithm (just different data). However this does **not** add `str::to_titlecase`, as that would require UAX#29 Unicode Text Segmentation which we decided not to include in of `std`: https://github.com/rust-lang/rfcs/pull/1054 I made `char::to_titlecase` immediately `#[stable]`, since it’s so similar to `char::to_uppercase` that’s already stable. Let me know if it should be `#[unstable]` for a while. * Add a special case for upper-case Sigma in word-final position in `str::to_lowercase`: #26035. This is the only language-independent conditional mapping currently in `SpecialCasing.txt`. * Stabilize `str::to_lowercase` and `str::to_uppercase`. The `&self -> String` on `str` signature seems straightforward enough, and the only relevant issue I’ve found is #24536 about naming. But `char` already has stable methods with the same name, and deprecating them for a rename doesn’t seem worth it. r? @alexcrichton
2015-06-09Implement Borrow<T> and BorrowMut<T> for Box<T: ?Sized>Ulrik Sverdrup-0/+29
2015-06-09Move collectionstest::char into coretest::charSimon Sapin-43/+0
2015-06-08Auto merge of #26077 - SimonSapin:patch-6, r=alexcrichtonbors-64/+64
With the latter is provided by the `From` conversion trait, the former is now completely redundant. Their code is identical. Let’s deprecate now and plan to remove in the next cycle. (It’s `#[unstable]`.) r? @alexcrichton CC @nagisa
2015-06-08Address a review comment and fix a bootstrapping issueSimon Sapin-1/+27
2015-06-08Replace usage of String::from_str with String:fromSimon Sapin-64/+64
2015-06-08Implement RFC 839Johannes Oertel-0/+213
Closes #25976.
2015-06-06Correctly map upper-case Sigma to lower-case in word-final position. Fix #26035.Simon Sapin-0/+13
2015-06-06Add char::to_titlecaseSimon Sapin-0/+10
But not str::to_titlecase which would require UAX#29 Unicode Text Segmentation which we decided not to include in of `std`: https://github.com/rust-lang/rfcs/pull/1054
2015-06-06Add complex (but unconditional) Unicode case mapping. Fix #25800Simon Sapin-0/+33
As a result, the iterator returned by `char::to_uppercase` sometimes yields two or three `char`s instead of just one.
2015-05-29add const_fn featuresNiko Matsakis-0/+1
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-2/+2
2015-05-10Implement `append` and `split_off` for BitSet (RFC 509)Johannes Oertel-0/+62
2015-05-07Auto merge of #24890 - jooert:bitvec-append-split_off, r=alexcrichtonbors-0/+136
cc #19986 r? @Gankro
2015-05-06Implement append and split_off for BitVec (RFC 509)Johannes Oertel-0/+136
2015-05-04Implement retain for vec_dequeSteven Allen-0/+10
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-02Override Iterator::count method in vec::IntoItersinkuu-0/+5
2015-05-01collections: Implement String::drain(range) according to RFC 574Ulrik Sverdrup-0/+17
`.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-04-28Register new snapshotsTamir Duberstein-2/+0
2015-04-28collections: Implement vec::drain(range) according to RFC 574Ulrik Sverdrup-3/+34
Old `.drain()` on vec is performed using `.drain(..)` now. `.drain(range)` is unstable and under feature(collections_drain) [breaking-change]
2015-04-21implement rfc 1054: split_whitespace() fn, deprecate words()kwantam-3/+2
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-19collections: Move optimized String::from_str to String::fromErick Tryzelaar-0/+27
This implementation is currently about 3-4 times faster than using the `.to_string()` based approach.
2015-04-16deprecate Unicode functions that will be moved to crates.iokwantam-4/+10
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-14rollup merge of #24310: alexcrichton/stabilize-utf8-errorAlex Crichton-2/+1
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-14More test fixesAlex Crichton-9/+8
2015-04-14test: Fixup many library unit testsAlex Crichton-21/+18
2015-04-10std: Stabilize the Utf8Error typeAlex Crichton-2/+1
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.