about summary refs log tree commit diff
path: root/src/libcoretest/iter.rs
AgeCommit message (Collapse)AuthorLines
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
2015-01-29convert remaining `range(a, b)` to `a..b`Jorge Aparicio-15/+15
2015-01-29`for x in range(a, b)` -> `for x in a..b`Jorge Aparicio-1/+1
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-29`range(a, b).foo()` -> `(a..b).foo()`Jorge Aparicio-4/+4
sed -i 's/ range(\([^,]*\), *\([^()]*\))\./ (\1\.\.\2)\./g' **/*.rs
2015-01-23Auto merge of #21453 - Stebalien:exactsize, r=alexcrichtonbors-4/+57
Specifically: * Peekable * ByRef * Skip * Take * Fuse Fixes #20547
2015-01-21Add test cases for ExactSizeIterator implsSteven Allen-4/+57
ByRef is not tested included because it is a trivial pass through.
2015-01-19remove unnecessary parentheses from range notationJorge Aparicio-1/+1
2015-01-12cleanup: `&foo[0..a]` -> `&foo[..a]`Jorge Aparicio-10/+10
2015-01-07falloutNick Cameron-18/+17
2015-01-07Replace full slice notation with index callsNick Cameron-14/+14
2015-01-05More test fixes!Alex Crichton-1/+1
2015-01-03Remove deprecated functionalityAlex Crichton-1/+1
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
2015-01-03coretest: fix falloutJorge Aparicio-1/+3
2015-01-02rollup merge of #20386: frewsxcv/rm-reexportsAlex Crichton-0/+1
Part of #19253 [breaking-change]
2015-01-02Fallout - change array syntax to use `;`Nick Cameron-2/+2
2014-12-31Remove core::iter::MinMaxResult::* public reexportCorey Farwell-0/+1
Part of #19253 [breaking-change]
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-10/+10
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-13libcoretest: use tuple indexingJorge Aparicio-1/+1