about summary refs log tree commit diff
path: root/src/libcore/ops.rs
AgeCommit message (Collapse)AuthorLines
2015-01-21rollup merge of #21258: aturon/stab-3-indexAlex Crichton-59/+8
Conflicts: src/libcore/ops.rs src/librustc_typeck/astconv.rs src/libstd/io/mem.rs src/libsyntax/parse/lexer/mod.rs
2015-01-21rollup merge of #21457: alexcrichton/issue-21436Alex Crichton-9/+9
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
2015-01-21rollup merge of #21367: steveklabnik/remove_gateAlex Crichton-30/+0
This gate was `Accepted`, so we shouldn't need these.
2015-01-21Stabilize Index traits and most range notationAaron Turon-63/+12
This commit marks as `#[stable]`: * The `Index` and `IndexMut` traits. These are stabilized as taking the index itself *by reference*; after extensive discussion it was determined that this is a better match with our choices elsewhere (e.g. making comparison operators auto-reference), and that the use cases for by-value indices are better handled through `IndexSet`. * The `Range`, `RangeFrom` and `RangeTo` structs, introduced for range notation. * Various impls of `Index` and `IndexMut`. The `FullRange` struct is left unstable as we may wish to rename it to `RangeFull` in the future. This commit also *removes* the `Step` trait in favor of direct implementation of iterator traits on ranges for integers. The `Step` trait was not a terribly useful factoring internally, and it is likely that external integer types are best off implementing range iterators directly. It was removed to simplify the API surface. We can always reintroduce `Step` later if it turns out to be useful. Due to this removal, this is a: [breaking-change]
2015-01-21Auto merge of #21227 - sellibitze:core-ops-for-references, r=aturonbors-4/+92
As discussed with @aturon I added implementations of various op traits for references to built-in types which was already suggested by the ops reform RFC. The 2nd commit updates the module documentation of core::ops to fully reflect the recent change from pass-by-reference to pass-by-value and expands on the implications for generic code.
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-9/+9
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes #21436
2015-01-20add stability text like suggested in discussionSebastian Gesemann-4/+4
2015-01-19Ranges implement Clone where possibleDiggory Blake-4/+4
2015-01-18Remove associated_types gate from std::ops docsSteve Klabnik-30/+0
2015-01-17Register new snapshots.Eduard Burtescu-18/+0
2015-01-17Make Index trait example clearerVolker Mische-12/+10
The example of the `Index` and `IndexMut` trait contained too much `Foo`. It now contains a bit more `Bar` to make things clearer which parts are defining the type of the index.
2015-01-16inline forward_xxx_xxx_binop macros as per suggestionSebastian Gesemann-25/+3
2015-01-16Fix/update core::ops module documentation w.r.t. operator traitsSebastian Gesemann-4/+12
* Not all traits are part of the prelude anymore * We switched from pass-by-reference to pass-by-value for most traits * Add some explanations around pass-by-value traits in the context of generic code and additional implementations for reference types.
2015-01-16libcore: implement many operators for references as wellSebastian Gesemann-0/+102
2015-01-11Allow any integral to be used as Shr and Shl RHSSimonas Kazlauskas-8/+60
This is only relevant to the code that uses generics such as fn magic<T: Shl>(a: T) { a << 10u8; } Fixes #20288
2015-01-08Remove String impls and fix for make tidyNick Cameron-51/+0
2015-01-08Show, String, Eq impls for RangesNick Cameron-4/+84
2015-01-06More test fixesAlex Crichton-2/+2
2015-01-06rollup merge of #20656: japaric/at-cleanAlex Crichton-1/+1
2015-01-06rollup merge of #20607: nrc/kindsAlex Crichton-1/+1
Conflicts: src/libcore/array.rs src/libcore/cell.rs src/libcore/prelude.rs src/libstd/path/posix.rs src/libstd/prelude/v1.rs src/test/compile-fail/dst-sized-trait-param.rs
2015-01-07markers -> markerNick Cameron-1/+1
2015-01-07Impls using the new scheme for slicingNick Cameron-101/+0
2015-01-07Change `std::kinds` to `std::markers`; flatten `std::kinds::marker`Nick Cameron-1/+1
[breaking-change]
2015-01-06cleanup: use short AT notation (`Ty::Item` instead of `<Ty as Trait>::Item`)Jorge Aparicio-1/+1
2015-01-05Merge remote-tracking branch 'nrc/sized-2' into rollupAlex Crichton-12/+12
Conflicts: src/liballoc/boxed.rs src/libcollections/btree/map.rs src/libcollections/slice.rs src/libcore/borrow.rs src/libcore/cmp.rs src/libcore/ops.rs src/libstd/c_str.rs src/libstd/collections/hash/map.rs src/libsyntax/parse/obsolete.rs src/test/compile-fail/unboxed-closure-sugar-default.rs src/test/compile-fail/unboxed-closure-sugar-equiv.rs src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs src/test/compile-fail/unboxed-closure-sugar-region.rs src/test/compile-fail/unsized3.rs src/test/run-pass/associated-types-conditional-dispatch.rs
2015-01-05rollup merge of #20556: japaric/no-for-sizedAlex Crichton-8/+8
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/libcore/borrow.rs src/libcore/cmp.rs src/libcore/ops.rs src/libstd/c_str.rs src/test/compile-fail/issue-19009.rs
2015-01-05rollup merge of #20560: aturon/stab-2-iter-ops-sliceAlex Crichton-0/+74
Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2015-01-06FalloutNick Cameron-14/+14
2015-01-05Stabilization of impls and fallout from stabilizationAaron Turon-0/+4
2015-01-05register snapshotJorge Aparicio-20/+0
2015-01-05Stabilize core::opsAaron Turon-0/+70
This commit marks as stable those parts of `core::ops` that are in their final planned form: `Drop`, all of the mathematical operators (`Add`, `Sub`, etc), `Deref`/`DerefMut`. It leaves the `Index*`, `Slice*` and `Fn*` traits unstable, as they are still undergoing active changes.
2015-01-05sed -i -s 's/ for Sized?//g' **/*.rsJorge Aparicio-10/+10
2015-01-04Merge pull request #20500 from globin/fix/range-sugarbors-1/+1
Fix range sugar Reviewed-by: nick29581
2015-01-04fix range sugarRobin Gloster-1/+1
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-19/+19
2015-01-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-1/+1
2015-01-03core: use assoc types in `Index[Mut]`Jorge Aparicio-6/+38
2015-01-03use assoc types in unop traitsJorge Aparicio-9/+27
2015-01-03use assoc types in binop traitsJorge Aparicio-43/+131
2015-01-03core: use assoc types in Iterator et alJorge Aparicio-4/+8
2015-01-02rollup merge of #20410: japaric/assoc-typesAlex Crichton-10/+24
Conflicts: src/liballoc/lib.rs src/libcollections/lib.rs src/libcollections/slice.rs src/libcore/ops.rs src/libcore/prelude.rs src/libcore/ptr.rs src/librustc/middle/traits/project.rs src/libstd/c_str.rs src/libstd/io/mem.rs src/libstd/io/mod.rs src/libstd/lib.rs src/libstd/path/posix.rs src/libstd/path/windows.rs src/libstd/prelude.rs src/libstd/rt/exclusive.rs src/libsyntax/lib.rs src/test/compile-fail/issue-18566.rs src/test/run-pass/deref-mut-on-ref.rs src/test/run-pass/deref-on-ref.rs src/test/run-pass/dst-deref-mut.rs src/test/run-pass/dst-deref.rs src/test/run-pass/fixup-deref-mut.rs src/test/run-pass/issue-13264.rs src/test/run-pass/overloaded-autoderef-indexing.rs
2015-01-02core: use assoc types in `Deref[Mut]`Jorge Aparicio-10/+22
2015-01-02std: Stabilize the prelude moduleAlex Crichton-4/+42
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2014-12-30Register new snapshotsAlex Crichton-99/+0
2014-12-30Add hypothetical support for ranges with only an upper boundNick Cameron-0/+8
Note that this doesn't add the surface syntax.
2014-12-24Review changesNick Cameron-59/+19
2014-12-24Add lang items for ranges.Nick Cameron-0/+3
2014-12-24Add structs for ranges to core::ops.Nick Cameron-0/+113
2014-12-21rollup merge of #19972: alexcrichton/snapshotsAlex Crichton-437/+0
Conflicts: src/libcollections/string.rs src/libcollections/vec.rs src/snapshots.txt
2014-12-19Register new snapshotsAlex Crichton-437/+0
This does not yet start the movement to rustc-serialize. That detail is left to a future PR.