about summary refs log tree commit diff
path: root/src/libcore/num
AgeCommit message (Collapse)AuthorLines
2020-01-23Add relevant associated constants to the float typesLinus Färnstrand-28/+135
2020-01-23Add MIN/MAX associated constants to the integer typesLinus Färnstrand-23/+47
2020-01-15Mark leading_trailing_ones with tracking issue 57969Thom Chiovoloni-4/+4
2020-01-12Add {leading,trailing}_ones to primitive int typesThom Chiovoloni-0/+83
2020-01-09Rollup merge of #67966 - popzxc:core-std-matches, r=CentrilMazdak Farrokhzad-40/+10
Use matches macro in libcore and libstd This PR replaces matches like ```rust match var { value => true, _ => false, } ``` with use of `matches!` macro. r? @Centril
2020-01-09Rollup merge of #67884 - anp:allow-unused-const-attr, r=oli-obkMazdak Farrokhzad-0/+3
Fix incremental builds of core by allowing unused attribute. I *think* that the same problem as in https://github.com/rust-lang/rust/issues/65023 was introduced by https://github.com/rust-lang/rust/pull/67657. This works around the current incrcomp issue with these attributes by allowing it here. This resolves the near-term issue for me, at least.
2020-01-08Use matches macro in libcore and libstdIgor Aleksanov-40/+10
2020-01-06Use Self instead of $typeLzu Tao-2/+2
2020-01-04Fix incremental builds of core by allowing unused attribute.Adam Perry-0/+3
The same problem as in https://github.com/rust-lang/rust/issues/65023 was introduced by https://github.com/rust-lang/rust/pull/67657. This works around the current incrcomp issue with these attributes by allowing it here.
2020-01-05Re-add comment about behaviour of inline.jumbatm-0/+3
2020-01-04Also remove const-hack for absjumbatm-18/+6
2019-12-31Rollup merge of #67430 - tspiteri:minus-inf, r=Dylan-DPCDylan DPC-2/+2
doc: minus (U+2212) instead of dash (U+002D) for negative infinity The documentation for [`f32::NEG_INFINITY`](https://doc.rust-lang.org/std/f32/constant.NEG_INFINITY.html) contains “-∞” with a dash instead of a minus sign, “−∞” with a proper minus sign looks better with the used Source Serif Pro font. Similarly for [`f64::NEG_INFINITY`](https://doc.rust-lang.org/std/f64/constant.NEG_INFINITY.html).
2019-12-30Rollup merge of #67657 - jumbatm:cleanup-const-hack, r=oli-obkYuki Okushi-12/+17
Clean up const-hack PRs now that const if / match exist. Closes #67627. Cleans up these merged PRs tagged with `const-hack`: - #63810 - #63786 - #61635 - #58044 reverting their contents to have the match or if expressions they originally contained. r? @oli-obk There's one more PR in those tagged with `const-hack` that originally wasn't merged (#65107). Reading the thread, it looks like it was originally closed because the `const-hack` for the checked arithmetic non-negligibly hurt performance, and because there was no way to manipulate the returned Option at compile time anyway (with neither const if nor const match). Would you like me to add these changes to the changes from this PR here too, now that we have the necessary features?
2019-12-27Clean up const-hack from #58044jumbatm-1/+6
2019-12-27Clean up const-hack from #61635jumbatm-1/+5
2019-12-27Clean up const-hack from #63786jumbatm-10/+6
2019-12-26Remove redundant link textsMatthew Kraai-2/+2
2019-12-24Show value for consts in the documentationOhad Ravid-1/+1
2019-12-22Format the worldMark Rousskov-3/+6
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-7/+7
2019-12-19doc: minus (U+2212) instead of dash (U+002D) for negative infinityTrevor Spiteri-2/+2
2019-12-18Propagate cfg bootstrapMark Rousskov-333/+78
2019-12-15use Self alias in place of macrosLzu Tao-2/+2
2019-12-15Rollup merge of #67305 - kappa:patch-1, r=jonas-schievinkMazdak Farrokhzad-1/+1
Doc typo
2019-12-14Doc typoAlex Kapranoff-1/+1
2019-12-14Auto merge of #67224 - nikomatsakis:revert-stabilization-of-never-type, ↵bors-0/+11
r=centril Revert stabilization of never type Fixes https://github.com/rust-lang/rust/issues/66757 I decided to keep the separate `never-type-fallback` feature gate, but tried to otherwise revert https://github.com/rust-lang/rust/pull/65355. Seemed pretty clean. ( cc @Centril, author of #65355, you may want to check this over briefly )
2019-12-14Revert "Stabilize the `never_type`, written `!`."Niko Matsakis-1/+1
This reverts commit 15c30ddd69d6cc3fffe6d304c6dc968a5ed046f1.
2019-12-14Revert "Redefine `core::convert::Infallible` as `!`."Niko Matsakis-0/+11
This reverts commit 089229a1935fa9795cfdefa518c8f8c3beb66db8.
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-17/+329
functions with a `const` modifier
2019-12-10Auto merge of #66277 - peter-wilkins:impl-from-wider-non-zeros, r=SimonSapinbors-85/+96
From<NonZero*> impls for wider NonZero types Closes: https://github.com/rust-lang/rust/issues/66291
2019-12-08move from non zero impls to `libcore/convert/num.rs`Peter-2058/+1955
2019-12-06Format libcore with rustfmt (including tests and benches)David Tolnay-1/+4
2019-12-06Move numeric `From` and `TryFrom` impls to `libcore/convert/num.rs`Simon Sapin-330/+1
This makes `libcore/num/mod.rs` slightly smaller. It’s still 4911 lines and not easy to navigate. This doesn’t change any public API.
2019-12-06Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methodsSimon Sapin-2/+62
As discussed in https://github.com/rust-lang/rust/issues/10184 Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range.
2019-11-29Make dec2flt_table compatible with rustfmtDavid Tolnay-1225/+1231
2019-11-28Clarify `{f32,f64}::EPSILON` docsOhad Ravid-2/+2
2019-11-27Rollup merge of #66769 - fusion-engineering-forks:tau-constant, r=dtolnayTyler Mandry-0/+12
Add core::{f32,f64}::consts::TAU. ### **`τ`**
2019-11-26Format libcore with rustfmtDavid Tolnay-334/+551
This commit applies rustfmt with default settings to files in src/libcore *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in `outstanding_files`, the relevant commands were: $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018 $ rg libcore outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libcore.
2019-11-26Add tracking issue number.Mara Bos-2/+2
2019-11-26Add core::{f32,f64}::consts::TAU.Mara Bos-0/+12
2019-11-21Redefine `core::convert::Infallible` as `!`.Mazdak Farrokhzad-11/+1
2019-11-21Stabilize the `never_type`, written `!`.Mazdak Farrokhzad-1/+1
2019-11-12update version metadataPeter-35/+35
2019-11-11add NonZeroU16 -> NonZeroUsize and NonZeroI16 -> NonZeroIsizePeter-0/+2
2019-11-10remove irrelevant Safety sectionPeter-38/+34
2019-11-10From<NonZero*> impls for wider NonZero typesPeter-0/+70
issue: https://github.com/rust-lang/rust/issues/66196
2019-11-08remove vestigial comments referring to defunct numeric trait hierarchyAlexander Nye-2/+0
see also https://github.com/rust-lang/rust/pull/23104/files
2019-11-06Have tidy ensure that we document all `unsafe` blocks in libcoreOliver Scherer-2/+31
2019-10-31Stabilize float_to_from_bytes featureLzu Tao-24/+12
2019-10-22Apply clippy::useless_let_if_seq suggestionMateusz Mikuła-5/+4