about summary refs log tree commit diff
path: root/src/libcoretest/iter.rs
AgeCommit message (Collapse)AuthorLines
2017-04-03Move libXtest into libX/testsStjepan Glavina-1084/+0
This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561.
2017-02-05Rollup merge of #39501 - phungleson:libcorebench, r=alexcrichtonCorey Farwell-91/+0
Extract libcore benchmarks to a separate folder Fix #39484 r? @alexcrichton since you seem to know about this :) Thanks!
2017-02-05Rollup merge of #39107 - llogiq:branchless_filter_count, r=alexcrichtonCorey Farwell-0/+6
branchless .filter(_).count() I found that the branchless version is only slower if we have little to no branch misses, which usually isn't the case. I notice speedups between -5% (perfect prediction) and 60% (real world data).
2017-02-04Extract libcore benchmarks to a separate folderSon-91/+0
2017-01-31Removes FIXMEs related to #22405Wesley Wiser-2/+0
2017-01-24add explanation, fix testAndre Bogus-1/+1
2017-01-18add test case for filter+countAndre Bogus-0/+6
2017-01-10Implement `iter::Sum` and `iter::Product` for `Result`Jake Goulding-0/+16
This introduces a private iterator adapter `ResultShunt`, which allows treating an iterator of `Result<T, E>` as an iterator of `T`.
2016-11-17core::iter: Peekable should remember peeking a NoneUlrik Sverdrup-0/+68
Peekable must remember if a None has been seen in the `.peek()` method. It ensures that `.peek(); .peek();` or `.peek(); .next();` only advances the underlying iterator at most once. This does not by itself make the iterator fused.
2016-10-25iter: Implement .fold() for .chain()Ulrik Sverdrup-0/+12
Chain can do something interesting here where it passes on the fold into its inner iterators. The lets the underlying iterator's custom fold() be used, and skips the regular chain logic in next.
2016-08-20Introduce max_by/min_by on iteratorsphilipp-0/+12
2016-06-14specialize zip: Add benchmarksUlrik Sverdrup-0/+31
2016-05-24std: Stabilize APIs for the 1.10 releaseAlex Crichton-9/+0
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-04-30Implement find() on Chain iteratorsGeorg Brandl-0/+13
This results in a roughly 2x speedup compared to the default impl "inherited" from Iterator.
2016-03-11cleanup int suffixes in libcoretestsrinivasreddy-4/+4
2016-03-04make skip a double ended iteratorOliver Schneider-0/+38
2016-01-30test: Deny warnings in {core,collections}testAlex Crichton-8/+8
Help cleans up our build a bit and stays in line with the rest of our crates denying warnings traditionally.
2015-12-10std: Remove deprecated functionality from 1.5Alex Crichton-12/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-08-27remove calls to deprecated `iter::order` functionsAndrew Paseltiner-27/+26
2015-08-25Correct iterator adaptor ChainUlrik Sverdrup-0/+20
The iterator protocol specifies that the iteration ends with the return value `None` from `.next()` (or `.next_back()`) and it is unspecified what further calls return. The chain adaptor must account for this in its DoubleEndedIterator implementation. It uses three states: - Both `a` and `b` are valid - Only the Front iterator (`a`) is valid - Only the Back iterator (`b`) is valid The fourth state (neither iterator is valid) only occurs after Chain has returned None once, so we don't need to store this state. Fixes #26316
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-186/+0
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-16/+16
2015-05-29Implement RFC 771: std::iter::onceNathaniel Theis-0/+13
2015-05-05Optimize iterator adapters.Steven Allen-0/+215
Specifically, make count, nth, and last call the corresponding methods on the underlying iterator where possible. This way, if the underlying iterator has an optimized count, nth, or last implementations (e.g. slice::Iter), these methods will propagate these optimizations. Additionally, change Skip::next to take advantage of a potentially optimized nth method on the underlying iterator.
2015-05-01iterator: Add `StepBy::size_hint` methodcritiqjo-1/+13
Fixes `Step::steps_between` implementations by integer types to correctly handle `by != 1`.
2015-04-27core: Fix size_hint for signed integer Range<T> iteratorsUlrik Sverdrup-0/+6
There was an overflow bug in .size_hint() for signed iterators, which produced an hilariously incorrect size or an overflow panic. Incorrect size is a serious bug since the iterators are marked ExactSizeIterator. (And leads to abort() on (-1i8..127).collect() when the collection tries to preallocate too much). All signed range iterators were affected. > (-1i8..127).size_hint() (18446744073709551488, Some(18446744073709551488)) Bug found using quickcheck. Fixes #24851
2015-04-21std: Bring back f32::from_str_radix as an unstable APIAlex Crichton-11/+0
This API was exercised in a few tests and mirrors the `from_str_radix` functionality of the integer types.
2015-04-10Auto merge of #24180 - huonw:optimise-max-etc, r=alexcrichtonbors-0/+31
The main change in this patch is removing the use of `Option` inside the inner loops of those functions to avoid comparisons where one branch will only trigger on the first pass through the loop. The included benchmarks go from: test bench_max ... bench: 372 ns/iter (+/- 118) test bench_max_by ... bench: 428 ns/iter (+/- 33) test bench_max_by2 ... bench: 7128 ns/iter (+/- 326) to: test bench_max ... bench: 317 ns/iter (+/- 64) test bench_max_by ... bench: 356 ns/iter (+/- 270) test bench_max_by2 ... bench: 1387 ns/iter (+/- 183) Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-10Optimise Iterator::{max, max_by, min, min_by}.Huon Wilson-0/+31
The main change in this patch is removing the use of `Option` inside the inner loops of those functions to avoid comparisons where one branch will only trigger on the first pass through the loop. The included benchmarks go from: test bench_max ... bench: 372 ns/iter (+/- 118) test bench_max_by ... bench: 428 ns/iter (+/- 33) test bench_max_by2 ... bench: 7128 ns/iter (+/- 326) to: test bench_max ... bench: 317 ns/iter (+/- 64) test bench_max_by ... bench: 356 ns/iter (+/- 270) test bench_max_by2 ... bench: 1387 ns/iter (+/- 183) Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-08Make `sum` and `product` inherent methods on `Iterator`Tobias Bucher-6/+6
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-03-31std: Clean out #[deprecated] APIsAlex Crichton-7/+7
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-26Mass rename uint/int to usize/isizeAlex Crichton-38/+38
Now that support has been removed, all lingering use cases are renamed.
2015-03-13Deprecate range, range_step, count, distributionsAaron Turon-6/+6
This commit deprecates the `count`, `range` and `range_step` functions in `iter`, in favor of range notation. To recover all existing functionality, a new `step_by` adapter is provided directly on `ops::Range` and `ops::RangeFrom`. [breaking-change]
2015-03-09Rename #[should_fail] to #[should_panic]Steven Fackler-1/+1
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-4/+4
2015-03-03Switched to Box::new in many places.Felix S. Klock II-4/+7
Many of the modifications putting in `Box::new` calls also include a pointer to Issue 22405, which tracks going back to `box <expr>` if possible in the future. (Still tried to use `Box<_>` where it sufficed; thus some tests still have `box_syntax` enabled, as they use a mix of `box` and `Box::new`.) Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-03-01Remove int/uint from libstd/lib.rsGuillaume Gomez-7/+7
2015-02-24Use arrays instead of vectors in testsVadim Petrochenkov-32/+21
2015-02-20fix a few 'variable does not need to be mutable' warningsTshepang Lekhonkhobe-8/+8
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-1/+1
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-1/+1
2015-02-18Remove usage of .map(|&foo| foo)Kevin Butler-21/+21
2015-02-18Opt for .cloned() over .map(|x| x.clone()) etc.Kevin Butler-1/+1
2015-02-10Deprecating i/u suffixes in libcoretestAlfie John-45/+45
2015-02-08Fix std::ops::Range size_hint and ExactSizeIterator implsUlrik Sverdrup-0/+1
When self.start > self.end, these iterators simply return None, so we adjust the size_hint to just return zero in this case. Certain optimizations can be implemented in and outside libstd if we know we can trust the size_hint for all inputs to for example Range<usize>. This corrects the ExactSizeIterator implementations, which IMO were unsound and incorrect previously, since they allowed a range like (2..1) to return a size_hint of -1us in when debug assertions are turned off.
2015-01-31Kill more `isize`sTobias Bucher-2/+2
2015-01-30Test fixes and rebase conflictsAlex Crichton-8/+8
Also some tidying up of a bunch of crate attributes
2015-01-30rollup merge of #21631: tbu-/isize_policeAlex Crichton-90/+90
Conflicts: src/libcoretest/iter.rs
2015-01-30remove Copy impls from iteratorsJorge Aparicio-25/+25
2015-01-30Remove all `i` suffixesTobias Bucher-90/+90