about summary refs log tree commit diff
path: root/src/libcore/num
AgeCommit message (Collapse)AuthorLines
2018-09-08Document .0 to unpack the value from WrappingMartin Pool-0/+3
2018-09-05Individual docs for {from,to}_*_bytesAndre Bogus-251/+314
2018-09-03Add const_unstable flag to `overflowing_shr`Tim Diekmann-0/+1
2018-09-01rebaseTim-56/+496
2018-08-30Rollup merge of #53476 - GuillaumeGomez:try-from-int-error-partial-eq, r=KodrAusPietro Albini-1/+1
Add partialeq implementation for TryFromIntError type Fixes #53458.
2018-08-28Add partialeq implementation for TryFromIntError typeGuillaume Gomez-1/+1
2018-08-21Rollup merge of #53363 - llogiq:num-individual-nonzero-docs, r=steveklabnikkennytm-20/+23
add individual docs to `core::num::NonZero*`
2018-08-17Gratuitous at byte boundaries in hex i32 literals in some doc-testsSimon Sapin-4/+4
2018-08-14add individual docs to `core::num::NonZero*`Andre Bogus-20/+23
2018-08-14`{to,from}_{ne,le,be}_bytes` for unsigned integer typesSimon Sapin-16/+88
Same as https://github.com/rust-lang/rust/pull/51919 did for signed integers. Tracking issue: https://github.com/rust-lang/rust/issues/52963
2018-08-10Add individual documentation for <integer>`.swap_bytes`/.`reverse_bits`Andre Bogus-113/+112
2018-08-10Rollup merge of #53207 - llogiq:num-rotate-docs, r=QuietMisdreavuskennytm-113/+115
Add individual docs for rotate_{left, right}
2018-08-09Add individual docs for rotate_{left, right}Andre Bogus-113/+115
2018-08-05Correct invalid feature attributesvarkor-20/+0
2018-08-04Rollup merge of #53062 - ljedrz:redundant_field_names, r=Mark-Simulacrumkennytm-27/+27
Remove redundant field names in structs
2018-08-04Remove redundant field names in structsljedrz-27/+27
2018-08-04Change tracking issue from #49792 to #51919Tobias Bucher-8/+8
The old issue has already been in FCP, a new issue was opened for the new API.
2018-08-03Provide `{to,from}_{ne,le,be}_bytes` functions on integersTobias Bucher-14/+86
If one doesn't view integers as containers of bytes, converting them to bytes necessarily needs the specfication of encoding. I think Rust is a language that wants to be explicit. The `to_bytes` function is basically the opposite of that – it converts an integer into the native byte representation, but there's no mention (in the function name) of it being very much platform dependent. Therefore, I think it would be better to replace that method by three methods, the explicit `to_ne_bytes` ("native endian") which does the same thing and `to_{le,be}_bytes` which return the little- resp. big-endian encoding.
2018-07-30Revert "Stabilize to_bytes and from_bytes for integers."Simon Sapin-4/+12
This reverts commit c8f9b84b393915a48253e3edc862c15a9b7152a7.
2018-07-11use proper footnote syntax for referencesAndy Russell-13/+11
The previous syntax was causing rustdoc to interpret them as links.
2018-07-08Fix some linksGuillaume Gomez-4/+4
2018-07-04Auto merge of #51395 - SimonSapin:repr-transparent, r=SimonSapinbors-0/+2
Add #[repr(transparent)] to some libcore types * `UnsafeCell` * `Cell` * `NonZero*` * `NonNull` * `Unique` CC https://github.com/rust-lang/rust/issues/43036
2018-07-03Auto merge of #51564 - SimonSapin:try-int, r=alexcrichtonbors-10/+60
Implement always-fallible TryFrom for usize/isize conversions that are infallible on some platforms This reverts commit 837d6c70233715a0ae8e15c703d40e3046a2f36a "Remove TryFrom impls that might become conditionally-infallible with a portability lint". This fixes #49415 by adding (restoring) missing `TryFrom` impls for integer conversions to or from `usize` or `isize`, by making them always fallible at the type system level (that is, with `Error=TryFromIntError`) even though they happen to be infallible on some platforms (for some values of `size_of::<usize>()`). They had been removed to allow the possibility to conditionally having some of them be infallible `From` impls instead, depending on the platforms, and have the [portability lint](https://github.com/rust-lang/rfcs/pull/1868) warn when they are used in code that is not already opting into non-portability. For example `#[allow(some_lint)] usize::from(x: u64)` would be valid on code that only targets 64-bit platforms. This PR gives up on this possiblity for two reasons: * Based on discussion with @aturon, it seems that the portability lint is not happening any time soon. It’s better to have the conversions be available *at all* than keep blocking them for so long. Portability-lint-gated platform-specific APIs can always be added separately later. * For code that is fine with fallibility, the alternative would force it to opt into "non-portability" even though there would be no real portability issue.
2018-06-30Bootstrap from 1.28.0-beta.3Mark Simulacrum-193/+0
2018-06-26Stabilize to_bytes and from_bytes for integers.Thayne McCombs-12/+4
Fixes #49792
2018-06-16Add #[repr(transparent)] to some libcore typesSimon Sapin-0/+2
* `UnsafeCell` * `Cell` * `NonZero*` * `NonNull` * `Unique`
2018-06-10add some docs to conversionsAndre Bogus-13/+39
2018-06-06Make the size of Option<NonZero*> a documented guarantee.Simon Sapin-2/+2
Closes #49137, the tracking issue for `NonZero*`, as this was the last remaining open question. Note that `ptr::NonNull<T>` already documents a similar guarantee.
2018-06-06Revert "Remove TryFrom impls that might become conditionally-infallible with ↵Simon Sapin-10/+60
a portability lint" This reverts commit 837d6c70233715a0ae8e15c703d40e3046a2f36a. Fixes https://github.com/rust-lang/rust/issues/49415
2018-06-03Rollup merge of #51299 - faern:const-int-ops, r=oli-obkMark Simulacrum-14/+280
const fn integer operations A follow up to #51171 Fixes #51267 Makes a lot of the integer methods (`swap_bytes`, `count_ones` etc) `const fn`s. See #51267 for a discussion about why this is wanted and the solution used.
2018-06-02Rollup merge of #50919 - frewsxcv:frewsxcv-epsilon, r=steveklabnikMark Simulacrum-2/+10
Provide more context for what the {f32,f64}::EPSILON values represent. Introduce the 'machine epsilon' term because if one googles 'epsilon', they might stumble upon https://en.wikipedia.org/wiki/Epsilon_numbers_(mathematics) instead of https://en.wikipedia.org/wiki/Machine_epsilon
2018-06-02Make integer methods non-const in stage0Linus Färnstrand-0/+192
2018-06-02Make most integer operations const fnsLinus Färnstrand-40/+114
2018-06-02Auto merge of #50554 - clarcharr:from_bool, r=TimNNbors-0/+14
Add From<bool> for int types Fixes #46109.
2018-06-01Add From<bool> for int typesClar Charr-0/+14
2018-06-01Add missing whitespace in num exampleGuillaume Gomez-1/+1
2018-05-28Auto merge of #50465 - clarcharr:wrapping, r=KodrAusbors-199/+488
Add missing Wrapping methods, use doc_comment! Re-opened version of #49393 . Finishing touches for #32463. Note that this adds `Shl` and `Shr` implementations for `Wrapping<i128>` and `Wrapping<u128>`, which were previously missed. This is technically insta-stable, but I don't know why this would be a problem.
2018-05-28Provide more context for what the {f32,f64}::EPSILON values represent.Corey Farwell-2/+10
2018-05-22Remove the unstable Float traitSimon Sapin-372/+166
Following up to #49896 and #50629. Fixes #32110. E0689 is weird.
2018-05-17Switch to 1.26 bootstrap compilerMark Simulacrum-8/+2
2018-05-17Rollup merge of #50808 - SimonSapin:nonzero, r=alexcrichtonkennytm-28/+8
Stabilize num::NonZeroU* Tracking issue: https://github.com/rust-lang/rust/issues/49137
2018-05-16Stabilize num::NonZeroU*Simon Sapin-9/+7
Tracking issue: https://github.com/rust-lang/rust/issues/49137
2018-05-16Remove unstable deprecated num::NonZeroI* typesSimon Sapin-17/+1
2018-05-16Make core::nonzero privateSimon Sapin-3/+1
It is now an implementation detail of ptr::NonNull and num::NonZero*
2018-05-16fix a typo in signed-integer::from_str_radix()SHA Miao-1/+1
just a small typo.
2018-05-15Separate feature gate for wrapping_next_power_of_twoClar Charr-4/+6
2018-05-09move See also links to topMichael Lamparski-4/+4
2018-05-08Add missing Wrapping methods, use doc_comment!Clar Charr-199/+486
2018-05-08Add more logarithm constantsClar Charr-0/+16
2018-04-24core: Minor cleanupDaiki Mizukami-1/+1