about summary refs log tree commit diff
path: root/src/libcoretest/num
AgeCommit message (Collapse)AuthorLines
2015-04-03Auto merge of #23832 - petrochenkov:usize, r=aturonbors-6/+6
These constants are small and can fit even in `u8`, but semantically they have type `usize` because they denote sizes and are almost always used in `usize` context. The change of their type to `u32` during the integer audit led only to the large amount of `as usize` noise (see the second commit, which removes this noise). This is a minor [breaking-change] to an unstable interface. r? @aturon
2015-04-01Fallout from changes for overflow-checking during constant evaluation.Felix S. Klock II-1/+1
2015-03-30Fix the falloutVadim Petrochenkov-6/+6
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-4/+4
2015-03-03Auto merge of #22532 - pnkfelix:arith-overflow, r=pnkfelix,eddybbors-4/+4
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-03Accommodate arith-overflow in `core::num`, `std::num`, `coretest::num`.Felix S. Klock II-4/+4
* `core::num`: adjust `UnsignedInt::is_power_of_two`, `UnsignedInt::next_power_of_two`, `Int::pow`. In particular for `Int::pow`: (1.) do not panic when `base` overflows if `acc` never observes the overflowed `base`, and (2.) if `acc` does observe the overflowed `base`, make sure we only panic if we would have otherwise (e.g. during a computation of `base * base`). * also in `core::num`: avoid underflow during computation of `uint::MAX`. * `std::num`: adjust tests `uint::test_uint_from_str_overflow`, `uint::test_uint_to_str_overflow`, `strconv` * `coretest::num`: adjust `test::test_int_from_str_overflow`.
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-10/+10
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-03-02Rollup merge of #22504 - GuillaumeGomez:audit-integer-libcore, r=ManishearthManish Goregaokar-26/+2
Part of #22240.
2015-03-01Remove int/uint from libstd/lib.rsGuillaume Gomez-26/+2
2015-03-01Make Int::pow() take exp as u32 instead usizeGuillaume Gomez-0/+11
2015-02-24Add missing `fn`Michał Krasnoborski-1/+1
2015-02-24Stop parsing "-" as integer, fixes #22745Michał Krasnoborski-0/+5
2015-02-10Deprecating i/u suffixes in libcoretestAlfie John-4/+4
2015-01-30rollup merge of #21631: tbu-/isize_policeAlex Crichton-7/+7
Conflicts: src/libcoretest/iter.rs
2015-01-30std: Stabilize FromStr and parseAlex Crichton-47/+47
This commits adds an associated type to the `FromStr` trait representing an error payload for parses which do not succeed. The previous return value, `Option<Self>` did not allow for this form of payload. After the associated type was added, the following attributes were applied: * `FromStr` is now stable * `FromStr::Err` is now stable * `FromStr::from_str` is now stable * `StrExt::parse` is now stable * `FromStr for bool` is now stable * `FromStr for $float` is now stable * `FromStr for $integral` is now stable * Errors returned from stable `FromStr` implementations are stable * Errors implement `Display` and `Error` (both impl blocks being `#[stable]`) Closes #15138
2015-01-30Remove all `i` suffixesTobias Bucher-7/+7
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-2/+2
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-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-06Register new snapshotsAlex Crichton-4/+2
Conflicts: src/librbml/lib.rs src/libserialize/json_stage0.rs src/libserialize/serialize_stage0.rs src/libsyntax/ast.rs src/libsyntax/ext/deriving/generic/mod.rs src/libsyntax/parse/token.rs
2015-01-07markers -> markerNick Cameron-1/+1
2015-01-07Change `std::kinds` to `std::markers`; flatten `std::kinds::marker`Nick Cameron-1/+1
[breaking-change]
2015-01-05Modernize macro_rules! invocationsKeegan McAllister-4/+5
macro_rules! is like an item that defines a macro. Other items don't have a trailing semicolon, or use a paren-delimited body. If there's an argument for matching the invocation syntax, e.g. parentheses for an expr macro, then I think that applies more strongly to the *inner* delimiters on the LHS, wrapping the individual argument patterns.
2015-01-05Rename macro_escape to macro_useKeegan McAllister-2/+4
In the future we want to support #[macro_use(foo, bar)] mod macros; but it's not an essential part of macro reform. Reserve the syntax for now.
2015-01-05Stop using macro_escape as an inner attributeKeegan McAllister-4/+5
In preparation for the rename.
2015-01-03Remove deprecated functionalityAlex Crichton-19/+19
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-03use assoc types in binop traitsJorge Aparicio-3/+3
2015-01-02std: Stabilize the prelude moduleAlex Crichton-0/+4
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-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-14/+14
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: fix unit testsJorge Aparicio-20/+22
2014-12-05Utilize fewer reexportsCorey Farwell-1/+2
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-11-16Move FromStr to core::strBrendan Zabarauskas-1/+115
2014-11-13Remove Signed trait and add SignedInt traitBrendan Zabarauskas-1/+1
The methods have been moved into Float and SignedInt
2014-11-13Remove lots of numeric traits from the preludesBrendan Zabarauskas-2/+12
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-11-13Deprecate Num, Unsigned and PrimitiveBrendan Zabarauskas-1/+1
2014-11-13Move checked arithmetic operators into Int traitBrendan Zabarauskas-7/+5
2014-11-13Move abs_sub to FloatMathBrendan Zabarauskas-8/+0
This removes the need for libcore to depend on libm. `abs_sub` is not as useful for integers.
2014-11-13Take parameters by-value in Signed traitBrendan Zabarauskas-4/+4
2014-09-05Make integer bit count methods return uintsBrendan Zabarauskas-6/+6
Fixes rust-lang/rfcs#224
2014-07-04Change Shl<T, T> for Int to Shl<uint, T>Samuel Neves-4/+4
2014-07-02Fix rotate_{left, right} for multiple of bitsize rotation amountsSamuel Neves-0/+18
Add additional rotation tests
2014-06-29Extract tests from libcore to a separate crateSteven Fackler-0/+427
Libcore's test infrastructure is complicated by the fact that many lang items are defined in the crate. The current approach (realcore/realstd imports) is hacky and hard to work with (tests inside of core::cmp haven't been run for months!). Moving tests to a separate crate does mean that they can only test the public API of libcore, but I don't feel that that is too much of an issue. The only tests that I had to get rid of were some checking the various numeric formatters, but those are also exercised through normal format! calls in other tests.