summary refs log tree commit diff
path: root/src/libcore/num
AgeCommit message (Collapse)AuthorLines
2017-05-20Auto merge of #42111 - ollie27:stab, r=Mark-Simulacrumbors-45/+45
Correct some stability versions These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-05-20Correct some stability versionsOliver Middleton-45/+45
These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-05-16Auto merge of #41907 - est31:macro_unused, r=jseyfriedbors-0/+1
Add lint for unused macros Addresses parts of #34938, to add a lint for unused macros. We now output warnings by default when we encounter a macro that we didn't use for expansion. Issues to be resolved before this PR is ready for merge: - [x] fix the NodeId issue described above - [x] remove all unused macros from rustc and the libraries or set `#[allow(unused_macros)]` next to them if they should be kept for some reason. This is needed for successful boostrap and bors to accept the PR. -> #41934 - [x] ~~implement the full extent of #34938, that means the macro match arm checking as well.~~ *let's not do this for now*
2017-05-15Auto merge of #41859 - froydnj:align-float-parts, r=sfacklerbors-8/+8
fix confusion about parts required for float formatting The documentation for flt2dec doesn't match up with the actual implementation, so fix the documentation to align with reality. Presumably due to the mismatch, the formatting code for floats in std::fmt can use correspondingly shorter arrays in some places, so fix those places up as well. Fixes #41304.
2017-05-13libcore: #[allow] some unused macrosest31-0/+1
2017-05-12Remove some unused macros from the rust codebaseest31-27/+0
Removes unused macros from: * libcore * libcollections The last use of these two macros was removed in commit b64c9d56700e2c41207166fe8709711ff02488ff when the char_range_at_reverse function was been removed. * librustc_errors Their last use was removed by commits 2f2c3e178325dc1837badcd7573c2c0905fab979 and 11dc974a38fd533aa692cea213305056cd3a6902. * libsyntax_ext * librustc_trans Also, put the otry macro in back/msvc/mod.rs under the same cfg argument as the places that use it.
2017-05-09fix confusion about parts required for float formattingNathan Froyd-8/+8
The documentation for flt2dec doesn't match up with the actual implementation, so fix the documentation to align with reality. Presumably due to the mismatch, the formatting code for floats in std::fmt can use correspondingly shorter arrays in some places, so fix those places up as well. Fixes #41304.
2017-04-29Update stage0 bootstrap compilerAlex Crichton-72/+0
We've got a freshly minted beta compiler, let's update to use that on nightly! This has a few other changes associated with it as well * A bump to the rustc version number (to 1.19.0) * Movement of the `cargo` and `rls` submodules to their "proper" location in `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude` option this can work. * Updates of the `cargo` and `rls` submodules to their master branches. * Tweak to the `src/stage0.txt` format to be more amenable for Cargo version numbers. On the beta channel Cargo will bootstrap from a different version than rustc (e.g. the version numbers are different), so we need different configuration for this. * Addition of `dev` as a readable key in the `src/stage0.txt` format. If present then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead of `static.rust-lang.org`. This is added to accomodate our updated release process with Travis and AppVeyor.
2017-04-20Remove float_extrasJosh Stone-150/+36
[unstable, deprecated since 1.11.0]
2017-04-20Remove num::{Zero,One}Josh Stone-72/+0
[unstable, deprecated since 1.11.0]
2017-04-14Use associated constants in core::num::dec2fltRobin Kruppe-152/+98
2017-04-05Rollup merge of #41037 - stjepang:move-libxtest, r=alexcrichtonCorey Farwell-4/+4
Move libXtest into libX/tests This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561. r? @alexcrichton
2017-04-03Replace ^ with <sup> html baliseGuillaume Gomez-6/+7
2017-04-03Move libXtest into libX/testsStjepan Glavina-4/+4
This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561.
2017-03-25Fix typo in dec2flt/algorithm.rsIrfan Hudda-2/+2
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-7/+7
2017-03-19Rollup merge of #40521 - TimNN:panic-free-shift, r=alexcrichtonCorey Farwell-18/+99
Implemente overflowing_sh* with new unchecked_sh* intrinsics Also update some 128 bit builtins to not rely on the constant evaluator to avoid checked operations. Fixes #40508. cc @nagisa, @alexcrichton Note: I still have a build running to see if the 128 bit changes worked (unoptimized builds take *forever* to compile), however at least the overflowing builtins no longer reference `core::panicking::panic`.
2017-03-19Rollup merge of #40281 - jimmycuadra:try-from-from-str, r=aturonCorey Farwell-3/+3
Rename TryFrom's associated type and implement str::parse using TryFrom. Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err". See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968. `TryFrom<&str>` and `FromStr` are equivalent, so have the latter provide the former to ensure that. Using `TryFrom` in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to suggest implementing `TryFrom<&str>` instead for new code. See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994 and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827. Refs #33417.
2017-03-18add inline attributes to stage 0 methodsTim Neumann-0/+4
2017-03-15Rename TryFrom's associated type and implement str::parse using TryFrom.Jimmy Cuadra-3/+3
Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err". See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968. TryFrom<&str> and FromStr are equivalent, so have the latter provide the former to ensure that. Using TryFrom in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to suggest implementing `TryFrom<&str>` instead for new code. See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994 and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827. Refs #33417.
2017-03-15make shift builtins panic-free with new unchecked_sh* intrinsicsTim Neumann-18/+95
Also update some 128 bit builtins to be panic-free without relying on the const evaluator.
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-5/+5
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-02-05Auto merge of #39408 - ollie27:i128_try_from, r=alexcrichtonbors-4/+4
Fix TryFrom for i128/u128 Another case of `as` cast silent truncation being error prone. This also adds a few missing TryFrom tests to libcoretest. cc #33417 cc #35118
2017-02-05Rollup merge of #39393 - ollie27:stab_impls, r=alexcrichtonCorey Farwell-16/+26
Fix a few impl stability attributes The versions show up in rustdoc.
2017-02-04Fix TryFrom for i128/u128Oliver Middleton-4/+4
Another case of `as` cast silent truncation being error prone. This also adds a few missing TryFrom tests to libcoretest.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-78/+4
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2017-01-29Fix a few impl stability attributesOliver Middleton-16/+26
The versions show up in rustdoc.
2017-01-06Make members of {std,core}::{i128,u128} unstableest31-24/+26
Adding it in a stable form was an accident. It thankfully only leaked to nightly. Fixes #38860
2016-12-30Fix rebase falloutest31-0/+21
2016-12-30Wrapping<i128> and attempt at LLVM 3.7 compatSimonas Kazlauskas-0/+2
This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-34/+143
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-10-23Implement ops on `&Wrapping<T>`Cristi Cobzarenco-0/+10
2016-10-12run rustfmt on libcore/num folderSrinivas Reddy Thatiparthy-54/+112
2016-10-07rewrite checked_{div,rem} to no contain any reference to panicsJorge Aparicio-8/+6
even without optimizations
2016-10-04Rollup merge of #36902 - ollie27:stab_impls, r=alexcrichtonManish Goregaokar-7/+7
std: Correct stability attributes for some implementations These are displayed by rustdoc so should be correct.
2016-10-03std: Stabilize and deprecate APIs for 1.13Alex Crichton-9/+3
This commit is intended to be backported to the 1.13 branch, and works with the following APIs: Stabilized * `i32::checked_abs` * `i32::wrapping_abs` * `i32::overflowing_abs` * `RefCell::try_borrow` * `RefCell::try_borrow_mut` * `DefaultHasher` * `DefaultHasher::new` * `DefaultHasher::default` Deprecated * `BinaryHeap::push_pop` * `BinaryHeap::replace` * `SipHash13` * `SipHash24` * `SipHasher` - use `DefaultHasher` instead in the `std::collections::hash_map` module Closes #28147 Closes #34767 Closes #35057 Closes #35070
2016-10-01std: Correct stability attributes for some implementationsOliver Middleton-7/+7
These are displayed by rustdoc so should be correct.
2016-09-22Rollup merge of #36423 - GuillaumeGomez:eq_impl, r=pnkfelixJonathan Turner-7/+7
Add missing Eq implementations Part of #36301.
2016-09-19Auto merge of #34942 - porglezomp:master, r=sfacklerbors-15/+11
Fix overflow checking in unsigned pow() The pow() method for unsigned integers produced 0 instead of trapping overflow for certain inputs. Calls such as 2u32.pow(1024) produced 0 when they should trap an overflow. This also adds tests for the correctly handling overflow in unsigned pow(). This was previously fixed for signed integers in #28248, but it seems unsigned integers got missed that time. For issue number #34913
2016-09-18Add missing Eq implementationsGuillaume Gomez-7/+7
2016-09-11Use question_mark feature in libcore.Ahmed Charles-2/+2
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-24/+2
2016-08-06Fix overflow checking in unsigned pow()Caleb Jones-15/+11
The pow() method for unsigned integers produced 0 instead of trapping overflow for certain inputs. Calls such as 2u32.pow(1024) produced 0 when they should trap an overflow. This also adds tests for the correctly handling overflow in unsigned pow(). For issue number #34913
2016-07-28Add non-panicking abs() functions to all signed integer types.Jethro Beekman-0/+84
Currently, calling abs() on one of the signed integer types might panic (in debug mode at least) because the absolute value of the largest negative value can not be represented in that signed type. Unlike all other integer operations, there is currently not a non-panicking version on this function. This seems to just be an oversight in the design, therefore just adding it now.
2016-07-15Improve float number exampleGuillaume Gomez-1/+1
2016-07-13Add examples for FpCategoryggomez-5/+24
2016-07-08Improve primitive integers documentationGuillaume Gomez-0/+32
2016-07-06Rollup merge of #34277 - ollie27:docs_num, r=steveklabnikSteve Klabnik-65/+64
Add/improve num const docs This adds short summaries to all num consts. r? @steveklabnik
2016-07-03std: Stabilize APIs for the 1.11.0 releaseAlex Crichton-34/+90
Although the set of APIs being stabilized this release is relatively small, the trains keep going! Listed below are the APIs in the standard library which have either transitioned from unstable to stable or those from unstable to deprecated. Stable * `BTreeMap::{append, split_off}` * `BTreeSet::{append, split_off}` * `Cell::get_mut` * `RefCell::get_mut` * `BinaryHeap::append` * `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past libstd stabilizations * `Iterator::sum` * `Iterator::product` Deprecated * `{f32, f64}::next_after` * `{f32, f64}::integer_decode` * `{f32, f64}::ldexp` * `{f32, f64}::frexp` * `num::One` * `num::Zero` Added APIs (all unstable) * `iter::Sum` * `iter::Product` * `iter::Step` - a few methods were added to accomodate deprecation of One/Zero Removed APIs * `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is unstable Closes #27739 Closes #27752 Closes #32526 Closes #33444 Closes #34152 cc #34529 (new tracking issue)
2016-06-30Correct MIN_EXP docs and improve EPSILONOliver Middleton-4/+4