summary refs log tree commit diff
path: root/src/libcore/num
AgeCommit message (Collapse)AuthorLines
2017-06-28Auto merge of #42431 - nagisa:core-float-2, r=alexcrichtonbors-12/+24
Fix NaN handling in is_sign_negative/positive This would be my proposed fix for the #42425 provided we decide it is indeed a problem. Note this would technically be a breaking change to a stable API. We might want to consider deprecating these methods and adding new ones.
2017-06-22Fix NaN handling in is_sign_negative/positiveSimonas Kazlauskas-12/+24
See #42425
2017-06-16Auto merge of #42430 - nagisa:core-float, r=alexcrichtonbors-0/+63
Re-implement float min/max in rust This also adds the relevant implementations into libcore. See #42423
2017-06-14Re-implement float min/max in rustSimonas Kazlauskas-0/+63
See #42423
2017-06-08Use ctlz_nonzero to improve ASM from next_power_of_twoScott McMurray-1/+16
2017-06-08Auto merge of #40706 - irfanhudda:doc-next-power-of-two, r=alexcrichtonbors-11/+27
Improve documentation of next_power_of_two Clarify overflow behavior of `next_power_of_two`. Related Issue: #18604
2017-05-31Simplify helper functionsIrfan Hudda-15/+13
Based on @scottmcm 's suggestion
2017-05-23Add comments to explain helper functionsIrfan Hudda-5/+13
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-29Simplify `checked_next_power_of_two` functionIrfan Hudda-6/+1
2017-04-29Add comment about overflow behavior for next_power_of_twoIrfan Hudda-0/+3
2017-04-28Add helper functions for `next_power_of_two` and `checked_next_power_of_two`Irfan Hudda-10/+14
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-20remove redundant wrapping_subIrfan Hudda-1/+1
2017-04-19next_power_of_two panic on overflowIrfan Hudda-2/+8
2017-04-18Improve documentation of next_power_of_twoIrfan Hudda-1/+3
Clarify overflow behavior of `next_power_of_two`. Related Issue: #18604
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