about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2014-11-14auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichtonbors-706/+793
This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below: [breaking-change] - `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`. - `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead. - `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers. - `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value. - `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that - `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically. - `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead. - The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt` - `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types. - `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.
2014-11-14Revert the need for initial values with arithmetic iteratorsBrendan Zabarauskas-18/+50
2014-11-13convert 1 line match to 2 lines for readabilityareski-5/+20
2014-11-12Register new snapshotsAlex Crichton-345/+0
2014-11-13Remove Signed trait and add SignedInt traitBrendan Zabarauskas-120/+156
The methods have been moved into Float and SignedInt
2014-11-13Remove lots of numeric traits from the preludesBrendan Zabarauskas-3/+27
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-11-13Clean up core::num doc commentsBrendan Zabarauskas-50/+45
2014-11-13Deprecate signum wrapper and clean up signed implsBrendan Zabarauskas-38/+42
2014-11-13Deprecate Num, Unsigned and PrimitiveBrendan Zabarauskas-53/+68
2014-11-13Deprecate Zero and One traitsBrendan Zabarauskas-158/+157
2014-11-13Deprecate Bounded traitBrendan Zabarauskas-57/+86
2014-11-13Move checked arithmetic operators into Int traitBrendan Zabarauskas-243/+212
2014-11-13Rejig Int impl macrosBrendan Zabarauskas-20/+32
This should make implementing the checked operator methods easier
2014-11-13Move saturating operator methods into IntBrendan Zabarauskas-40/+25
2014-11-13Create UnsignedInt trait and deprecate free functionsBrendan Zabarauskas-29/+50
2014-11-13Move abs_sub to FloatMathBrendan Zabarauskas-22/+0
This removes the need for libcore to depend on libm. `abs_sub` is not as useful for integers.
2014-11-13Deprecate Signed method wrappersBrendan Zabarauskas-19/+7
2014-11-13Take parameters by-value in Signed traitBrendan Zabarauskas-27/+27
2014-11-12Results aren't panicsArtem-1/+1
A typo about Results being panics crawled in. Fixing it.
2014-11-12Fix remaining documentation to reflect fail!() -> panic!()Barosl Lee-65/+65
Throughout the docs, "failure" was replaced with "panics" if it means a task panic. Otherwise, it remained as is, or changed to "errors" to clearly differentiate it from a task panic.
2014-11-10auto merge of #18795 : haberman/rust/master, r=cmrbors-1/+2
Previously Int inherited from PartialOrd (via Primitive) but not Ord. But integers have a total order, so inheriting from Ord is appropriate. Fixes #18776.
2014-11-08Make Int inherit from Ord.Josh Haberman-1/+2
Previously Int inherited from PartialOrd (via Primitive) but not Ord. But integers have a total order, so inheriting from Ord is appropriate. Fixes #18776.
2014-11-08auto merge of #18475 : gamazeps/rust/toExtend, r=alexcrichtonbors-3/+4
Ensured that Extend & FromIterator are implemented for the libcollection. Removed the fact that FromIterator had to be implemented in order to implement Extend, as it did not make sense for LruCache (it needs to be given a size and there are no Default for LruCache). Changed the name from Extend to Extendable. Part of #18424
2014-11-08Renamed Extendable to Extendgamazeps-3/+4
In order to upgrade, simply rename the Extendable trait to Extend in your code Part of #18424 [breaking-change]
2014-11-08auto merge of #18731 : chris-morgan/rust/derive-Clone-for-TypeId, r=alexcrichtonbors-1/+1
2014-11-07auto merge of #18723 : mprobinson/rust/fence-typos, r=thestingerbors-4/+4
2014-11-07auto merge of #18714 : nikomatsakis/rust/issue-18621-deref-for-refs, r=aturonbors-0/+15
libs: add Deref, DerefMut impls for references, fixing a bug in compiler in the process that was blocking this. r? @aturon
2014-11-07Derive Clone for TypeId.Chris Morgan-1/+1
2014-11-06libs: add Deref, DerefMut impls for references, fixing a bug in compiler in ↵Niko Matsakis-0/+15
the process that was blocking this. Fixes #18621.
2014-11-06Implement Index/IndexMut for [T]Jorge Aparicio-3/+18
Closes #16529
2014-11-06Fix atomic::fence documentation typosMike Robinson-4/+4
2014-11-06Prelude: rename and consolidate extension traitsAaron Turon-235/+325
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses. The renamings are consistent with the [new `-Prelude` suffix](https://github.com/rust-lang/rfcs/pull/344). There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules. Because this renames traits, it is a: [breaking-change] However, I do not expect any code that currently uses the standard library to actually break. Closes #17917
2014-11-06auto merge of #18467 : japaric/rust/eq, r=alexcrichtonbors-4/+331
`eq`, `ne`, `cmp`, etc methods now require one less level of indirection when dealing with `&str`/`&[T]` ``` rust "foo".ne(&"bar") -> "foo".ne("bar") slice.cmp(&another_slice) -> slice.cmp(another_slice) // slice and another_slice have type `&[T]` ``` [breaking-change]
2014-11-05Add blanket impls to allow the various `Fn` traits to be interconverted.Niko Matsakis-20/+50
Fixes #18387.
2014-11-05DSTify PartialEq, PartialOrd, Eq, OrdJorge Aparicio-0/+329
2014-11-05Fix fallout of changing the expansion of `#[deriving(PartialEq)]`Jorge Aparicio-4/+2
2014-11-05auto merge of #18486 : nikomatsakis/rust/operator-dispatch, r=pcwaltonbors-4/+91
This branch cleans up overloaded operator resolution so that it is strictly based on the traits in `ops`, rather than going through the normal method lookup mechanism. It also adds full support for autoderef to overloaded index (whereas before autoderef only worked for non-overloaded index) as well as for the slicing operators. This is a [breaking-change]: in the past, we were accepting combinations of operands that were not intended to be accepted. For example, it was possible to compare a fixed-length array and a slice, or apply the `!` operator to a `&int`. See the first two commits in this pull-request for examples. One downside of this change is that comparing fixed-length arrays doesn't always work as smoothly as it did before. Before this, comparisons sometimes worked due to various coercions to slices. I've added impls for `Eq`, `Ord`, etc for fixed-lengths arrays up to and including length 32, but if the array is longer than that you'll need to either newtype the array or convert to slices. Note that this plays better with deriving in any case than the previous scheme. Fixes #4920. Fixes #16821. Fixes #15757. cc @alexcrichton cc @aturon
2014-11-05Remove incorrect doc annotation, mark experimental since we haven't ↵Niko Matsakis-5/+1
discussed in an API meeting
2014-11-05Add impls of the comparison operators for fixed-length arrays of lengths ↵Niko Matsakis-0/+91
0...32 and repair various cases where slices and fixed-length arrays were being compared.
2014-11-05Repair various cases where values of distinct types were being operatedNiko Matsakis-4/+4
upon (e.g., `&int` added to `int`).
2014-11-05Register snapshots.Eduard Burtescu-209/+4
2014-11-04libsyntax: Forbid escapes in the inclusive range `\x80`-`\xff` inPatrick Walton-1/+1
Unicode characters and strings. Use `\u0080`-`\u00ff` instead. ASCII/byte literals are unaffected. This PR introduces a new function, `escape_default`, into the ASCII module. This was necessary for the pretty printer to continue to function. RFC #326. Closes #18062. [breaking-change]
2014-11-03core: Fix fallout of changing `#[deriving(Clone)]`Jorge Aparicio-2/+0
2014-11-03rollup merge of #18537 : japaric/no-secretAlex Crichton-4/+132
2014-11-03rollup merge of #18460 : gamazeps/issue18451Alex Crichton-1/+1
2014-11-03auto merge of #18468 : jakub-/rust/iter-repeat, r=alexcrichtonbors-2/+7
Implements a part of RFC 235. [breaking-change]
2014-11-02Add error module with Error and FromError traitsAaron Turon-2/+2
As per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md) Closes #17747 Note that the `error` module must live in `std` in order to refer to `String`. Note that, until multidispatch lands, the `FromError` trait cannot be usefully implemented outside of the blanket impl given here.
2014-11-02core: Replace secret formatting functions with UFCS versionsJorge Aparicio-4/+132
2014-11-01collections: Remove all collections traitsAlex Crichton-77/+54
As part of the collections reform RFC, this commit removes all collections traits in favor of inherent methods on collections themselves. All methods should continue to be available on all collections. This is a breaking change with all of the collections traits being removed and no longer being in the prelude. In order to update old code you should move the trait implementations to inherent implementations directly on the type itself. Note that some traits had default methods which will also need to be implemented to maintain backwards compatibility. [breaking-change] cc #18424
2014-10-31DSTify HashJorge Aparicio-4/+5
- The signature of the `*_equiv` methods of `HashMap` and similar structures have changed, and now require one less level of indirection. Change your code from: ``` hashmap.find_equiv(&"Hello"); hashmap.find_equiv(&&[0u8, 1, 2]); ``` to: ``` hashmap.find_equiv("Hello"); hashmap.find_equiv(&[0u8, 1, 2]); ``` - The generic parameter `T` of the `Hasher::hash<T>` method have become `Sized?`. Downstream code must add `Sized?` to that method in their implementations. For example: ``` impl Hasher<FnvState> for FnvHasher { fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } } ``` must be changed to: ``` impl Hasher<FnvState> for FnvHasher { fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } // ^^^^^^ } ``` [breaking-change]