about summary refs log tree commit diff
path: root/src/libcollectionstest
AgeCommit message (Collapse)AuthorLines
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.
2015-04-08Auto merge of #23293 - tbu-:pr_additive_multiplicative, r=alexcrichtonbors-1/+0
Previously it could not be implemented for types outside `libcore/iter.rs` due to coherence issues.
2015-04-08Make `sum` and `product` inherent methods on `Iterator`Tobias Bucher-1/+0
In addition to being nicer, this also allows you to use `sum` and `product` for iterators yielding custom types aside from the standard integers. Due to removing the `AdditiveIterator` and `MultiplicativeIterator` trait, this is a breaking change. [breaking-change]
2015-04-07Auto merge of #23952 - Kimundi:more_string_pattern, r=alexcrichtonbors-1/+500
This adds the missing methods and turns `str::pattern` in a user facing module, as per RFC. This also contains some big internal refactorings: - string iterator pairs are implemented with a central macro to reduce redundancy - Moved all tests from `coretest::str` into `collectionstest::str` and left a note to prevent the two sets of tests drifting apart further. See https://github.com/rust-lang/rust/issues/22477
2015-04-05Added smoke tests for new methods.Marvin Löbel-12/+137
Fixed bug in existing StrSearcher impl
2015-04-05Moved coretest::str tests into collectiontest::strMarvin Löbel-1/+375
2015-04-03Auto merge of #23832 - petrochenkov:usize, r=aturonbors-41/+41
These constants are small and can fit even in `u8`, but semantically they have type `usize` because they denote sizes and are almost always used in `usize` context. The change of their type to `u32` during the integer audit led only to the large amount of `as usize` noise (see the second commit, which removes this noise). This is a minor [breaking-change] to an unstable interface. r? @aturon
2015-04-01rollup merge of #23860: nikomatsakis/copy-requires-cloneAlex Crichton-2/+2
Conflicts: src/test/compile-fail/coherence-impls-copy.rs
2015-04-01rollup merge of #23945: pnkfelix/gate-u-negateAlex Crichton-2/+2
Feature-gate unsigned unary negate. Discussed in weekly meeting here: https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2015-03-31.md#feature-gate--expr and also in the internals thread here: http://internals.rust-lang.org/t/forbid-unsigned-integer/752
2015-04-02Test fixes and rebase conflicts, round 2Alex Crichton-2/+2
Conflicts: src/libcore/num/mod.rs
2015-04-01std: Changing the meaning of the count to splitnAlex Crichton-19/+20
This commit is an implementation of [RFC 979][rfc] which changes the meaning of the count parameter to the `splitn` function on strings and slices. The parameter now means the number of items that are returned from the iterator, not the number of splits that are made. [rfc]: https://github.com/rust-lang/rfcs/pull/979 Closes #23911 [breaking-change]
2015-04-01Fallout in public-facing and semi-public-facing libsNiko Matsakis-2/+2
2015-03-31rollup merge of #23288: alexcrichton/issue-19470Alex Crichton-18/+18
This is a deprecated attribute that is slated for removal, and it also affects all implementors of the trait. This commit removes the attribute and fixes up implementors accordingly. The primary implementation which was lost was the ability to compare `&[T]` and `Vec<T>` (in that order). This change also modifies the `assert_eq!` macro to not consider both directions of equality, only the one given in the left/right forms to the macro. This modification is motivated due to the fact that `&[T] == Vec<T>` no longer compiles, causing hundreds of errors in unit tests in the standard library (and likely throughout the community as well). Closes #19470 [breaking-change]
2015-03-31rollup merge of #23873: alexcrichton/remove-deprecatedAlex Crichton-60/+57
Conflicts: src/libcollectionstest/fmt.rs src/libcollectionstest/lib.rs src/libcollectionstest/str.rs src/libcore/error.rs src/libstd/fs.rs src/libstd/io/cursor.rs src/libstd/os.rs src/libstd/process.rs src/libtest/lib.rs src/test/run-pass-fulldeps/compiler-calls.rs
2015-03-31Test fixes and rebase conflicts, round 1Alex Crichton-0/+1
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-73/+58
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-31std: Remove #[old_orphan_check] from PartialEqAlex Crichton-18/+18
This is a deprecated attribute that is slated for removal, and it also affects all implementors of the trait. This commit removes the attribute and fixes up implementors accordingly. The primary implementation which was lost was the ability to compare `&[T]` and `Vec<T>` (in that order). This change also modifies the `assert_eq!` macro to not consider both directions of equality, only the one given in the left/right forms to the macro. This modification is motivated due to the fact that `&[T] == Vec<T>` no longer compiles, causing hundreds of errors in unit tests in the standard library (and likely throughout the community as well). cc #19470 [breaking-change]
2015-03-31replace deprecated as_slice()Emeliov Dmitrii-4/+4
2015-03-30Remove unnecessary `as usize`Vadim Petrochenkov-41/+41
2015-03-30Fallout where types must be specified.Niko Matsakis-3/+3
This is due to a [breaking-change] to operators. The primary affected code is uses of the `Rng` trait where we used to (incorrectly) infer the right-hand-side type from the left-hand-side, in the case that the LHS type was a scalar like `i32`. The fix is to add a type annotation like `x + rng.gen::<i32>()`.
2015-03-28Remove IteratorExtSteven Fackler-1/+1
All methods are inlined into Iterator with `Self: Sized` bounds to make sure Iterator is still object safe. [breaking-change]
2015-03-24rollup merge of #23282: nikomatsakis/fn-trait-inheritanceAlex Crichton-2/+8
The primary motivation here is to sidestep #19032 -- for a time, I thought that we should improve coherence or otherwise extend the language, but I now think that any such changes will require more time to bake. In the meantime, inheritance amongst the fn traits is both logically correct *and* a simple solution to that obstacle. This change introduces inheritance and modifies the compiler so that it can properly generate impls for closures and fns. Things enabled by this PR (but not included in this PR): 1. An impl of `FnMut` for `&mut F` where `F : FnMut` (https://github.com/rust-lang/rust/issues/23015). 2. A better version of `Thunk` I've been calling `FnBox`. I did not include either of these in the PR because: 1. Adding the impls in 1 currently induces a coherence conflict with the pattern trait. This is interesting and merits some discussion. 2. `FnBox` deserves to be a PR of its own. The main downside to this design is (a) the need to write impls by hand; (b) the possibility of implementing `FnMut` with different semantics from `Fn`, etc. Point (a) is minor -- in particular, it does not affect normal closure usage -- and could be addressed in the future in many ways (better defaults; convenient macros; specialization; etc). Point (b) is unfortunate but "just a bug" from my POV, and certainly not unique to these traits (c.f. Copy/Clone, PartialEq/Eq, etc). (Until we lift the feature-gate on implementing the Fn traits, in any case, there is room to correct both of these if we find a nice way.) Note that I believe this change is reversible in the future if we decide on another course of action, due to the feature gate on implementing the `Fn` traits, though I do not (currently) think we should reverse it. Fixes #18835. r? @nrc
2015-03-23Test fixes and rebase conflicts, round 2Alex Crichton-0/+1
2015-03-23Fallout from changing fn traits to use inheritance rather than bridgeNiko Matsakis-2/+8
impls. This is a [breaking-change] (for gated code) in that when you implement `Fn` (`FnMut`) you must also implement `FnOnce`. This commit demonstrates how to fix it.
2015-03-23rollup merge of #23503: alexcrichton/fix-ptr-docsAlex Crichton-1/+1
The method with which backwards compatibility was retained ended up leading to documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-0/+1
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23Require feature attributes, and add them where necessaryBrian Anderson-0/+1
2015-03-21std: Remove deprecated ptr functionsAlex Crichton-1/+1
The method with which backwards compatibility was retained ended up leading to documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-19StrExt::splitn should not require a DoubleEndedSearcherJake Goulding-0/+14
Closes #23262
2015-03-19Introduce rsplitJake Goulding-0/+14
2015-03-17std: Stabilize `IteratorExt::cloned`Alex Crichton-1/+1
This commit stabilizes the `cloned` iterator after tweaking the signature to require that the iterator is over `&T` instead of `U: Deref<T>`. This method has had time to bake for awhile now and it's not clear whether the `Deref` bound is worth it. Additionally, there aren't clear conventions on when to bound and/or implement the `Deref` trait, so for now the conservative route is to require references instead of `U: Deref<T>`. To change this signature to using `Deref` would technically be a backwards-incompatible change, but it is doubtful that any code will actually break in practice.
2015-03-16move some tests back to libcollectionsJorge Aparicio-510/+0
2015-03-16enable enum_set testsJorge Aparicio-15/+18
2015-03-16extract libcollections tests into libcollectionstestJorge Aparicio-0/+9306