about summary refs log tree commit diff
path: root/src/libcore/iter.rs
AgeCommit message (Collapse)AuthorLines
2015-04-01Simplify `match` branches in iter.rs exampleCorey Farwell-4/+2
2015-03-31Test fixes and rebase conflicts, round 3Alex Crichton-1/+2
2015-03-31rollup merge of #23899: steveklabnik/gh23851Alex Crichton-9/+12
Conflicts: src/libcore/iter.rs
2015-03-31rollup merge of #23288: alexcrichton/issue-19470Alex Crichton-6/+5
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 #23908: aturon/stab-more-stragglersAlex Crichton-3/+2
* The `io::Seek` trait. * The `Iterator::{partition, unsip}` methods. * The `Vec::into_boxed_slice` method. * The `LinkedList::append` method. * The `{or_insert, or_insert_with` methods in the `Entry` APIs. r? @alexcrichton
2015-03-31Test fixes and rebase conflicts, round 2Alex Crichton-51/+71
2015-03-31rollup merge of #23873: alexcrichton/remove-deprecatedAlex Crichton-153/+13
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-31std: Clean out #[deprecated] APIsAlex Crichton-153/+13
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-31rollup merge of #23886: demelev/remove_as_slice_usageAlex Crichton-4/+4
2015-03-31rollup merge of #23878: Ryman/stable_extremesAlex Crichton-23/+35
`min`-like functions now return the leftmost element/input for equal elements. `max`-like return the rightmost. Closes #23687. cc @HeroesGrave, @aturon, @alexcrichton
2015-03-31Stabilize a few remaining stragglersAaron Turon-3/+2
* The `io::Seek` trait, and `SeekFrom` enum. * The `Iterator::{partition, unsip}` methods. * The `Vec::into_boxed_slice` method. * The `LinkedList::append` method. * The `{or_insert, or_insert_with` methods in the `Entry` APIs.
2015-03-31std: Remove #[old_orphan_check] from PartialEqAlex Crichton-6/+5
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-31Fix up iterator documentation with regards to for loop sugarSteve Klabnik-7/+10
Fixes #23851
2015-03-31Stabilize std::numAaron Turon-36/+122
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-30libcore: Ensure min and max functions are consistent for equal inputsKevin Butler-23/+35
2015-03-31replace deprecated as_slice()Emeliov Dmitrii-4/+4
2015-03-29Add an example for FromIterator::from_iterCorey Farwell-0/+21
2015-03-28Remove IteratorExtSteven Fackler-89/+94
All methods are inlined into Iterator with `Self: Sized` bounds to make sure Iterator is still object safe. [breaking-change]
2015-03-27Note that zip and enumerate are similarSteve Klabnik-0/+17
Fixes #22716
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-2/+20
2015-03-17std: Stabilize `IteratorExt::cloned`Alex Crichton-27/+18
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-13Deprecate range, range_step, count, distributionsAaron Turon-69/+113
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-12Rollup merge of #23247 - tbu-:pr_core_iter_rm_isize, r=huonwManish Goregaokar-3/+3
2015-03-11Example -> ExamplesSteve Klabnik-1/+1
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-10Purge `isize` from `core::iter`Tobias Bucher-3/+3
2015-03-08Add description of fold function arguments.Ɓukasz Niemier-1/+1
2015-03-06Rollup merge of #23025 - huonw:better-iter-infer, r=GankroManish Goregaokar-46/+48
This concretely improves type inference of some cases (see included test). I assume the compiler struggles to reason about multiple layers of generic type parameters (even with associated-type equalities) but *can* understand pure associated types, since they are always directly computable from the input types. Thanks to @shepmaster for noticing the issue with `Cloned` (I took that example as a test case).
2015-03-05Use more associated types in core::iter.Huon Wilson-46/+48
This concretely improves type inference of some cases (see included test). I assume the compiler struggles to reason about multiple layers of generic type parameters (even with associated-type equalities) but *can* understand pure associated types, since they are always directly computable from the input types.
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-1/+1
2015-03-04Auto merge of #22958 - laijs:option_map_for_iter_map, r=alexcrichtonbors-16/+3
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2015-03-03Auto merge of #22532 - pnkfelix:arith-overflow, r=pnkfelix,eddybbors-3/+8
Rebase and follow-through on work done by @cmr and @aatch. Implements most of rust-lang/rfcs#560. Errors encountered from the checks during building were fixed. The checks for division, remainder and bit-shifting have not been implemented yet. See also PR #20795 cc @Aatch ; cc @nikomatsakis
2015-03-03Rollup merge of #22952 - huonw:missing-stable, r=alexcrichtonManish Goregaokar-0/+2
Unstable is the conservative choice. cc #22950.
2015-03-03`core::iter`: fix bug uncovered by arith-overflow.Felix S. Klock II-1/+5
(The bug was in `impl RandomAccessIterator for Rev`; it may or may not have been innocuous, depending on what guarantees one has about the behavior of `idx` for the underlying iterator.)
2015-03-03fix Iter::rposition for new arith-overflow checking.Felix S. Klock II-2/+3
2015-03-02core: Audit num module for int/uintBrian Anderson-3/+3
* count_ones/zeros, trailing_ones/zeros return u32, not usize * rotate_left/right take u32, not usize * RADIX, MANTISSA_DIGITS, DIGITS, BITS, BYTES are u32, not usize Doesn't touch pow because there's another PR for it. [breaking-change]
2015-03-02iter: use Option::map() in struct Iterater::map()Lai Jiangshan-16/+3
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2015-03-02Add missing stability attributes on struct fields.Huon Wilson-0/+2
Unstable is the conservative choice. cc #22950.
2015-03-01Auto merge of #22898 - edwardw:one-less-unsafe-impl, r=huonwbors-5/+1
These implementations were temporary workaround. Now #22828 has been fixed, they can be removed.
2015-02-28Remove two unsafe impls from `iter::Peekable`Edward Wang-5/+1
These implementations were temporary workaround. Now #22828 has been fixed, they can be removed.
2015-02-28Update iter::order to be more generic.JP-Ellis-34/+20
Signed-off-by: JP-Ellis <coujellis@gmail.com>
2015-02-27Rollup merge of #22848 - tshepang:redundant-mention, r=brsonManish Goregaokar-2/+1
2015-02-27Rollup merge of #22833 - laijs:remove-redundant-else-branch, r=dotdashManish Goregaokar-2/+0
The branch \"else { continue }\" is the last code inside a loop body, it is just useless. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2015-02-27Rollup merge of #22795 - alexcrichton:issue-22617, r=huonwManish Goregaokar-2/+2
Keeps the method consistent with `Iterator::any`. Closes #22617 [breaking-change]
2015-02-26doc: the last mention of the word 'iterator' is redundantTshepang Lekhonkhobe-2/+1
2015-02-26remove the redundant else branchLai Jiangshan-2/+0
The branch "else { continue }" is the last code inside a loop body, it is just useless. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2015-02-26Send/Sync audit for libcollectionsEdward Wang-1/+5
In the process, also replaces a raw mutable pointers with Unique to spell out the ownership semantics. cc #22709
2015-02-24std: Require `&mut self` for Iterator::allAlex Crichton-2/+2
Keeps the method consistent with `Iterator::any`. Closes #22617 [breaking-change]
2015-02-25Rollup merge of #22635 - kmcallister:macros-chapter, r=steveklabnikManish Goregaokar-1/+1
r? @steveklabnik
2015-02-24Use arrays instead of vectors in testsVadim Petrochenkov-2/+2
2015-02-24core: fix typo that wasn't caught by the hacky previous implementation.Eduard Burtescu-1/+1