summary refs log tree commit diff
path: root/src/libcore/num
AgeCommit message (Collapse)AuthorLines
2018-12-01Rollup merge of #56355 - Zoxc:inline-things, r=michaelwoeristerkennytm-0/+1
Add inline attributes and add unit to CommonTypes
2018-12-01Rollup merge of #56216 - SimonSapin:array-tryfrom-slice, r=withoutboatskennytm-0/+78
Add TryFrom<&[T]> for [T; $N] where T: Copy `TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`. Also add doc examples doing just that.
2018-11-29Add inline attributes and add unit to CommonTypesJohn Kåre Alsaker-0/+1
2018-11-26Auto merge of #55705 - ethanboxx:master, r=SimonSapinbors-1/+24
Make `ParseIntError` and `IntErrorKind` fully public Why would you write nice error types if I can't read them? # Why It can be useful to use `match` with errors produced when parsing strings to int. This would be useful for the `.err_match()` function in my [new crate](https://crates.io/crates/read_input). --- I could also do this for `ParseFloatError` if people think it is a good idea. I am new around hear so please tell me if I am getting anything wrong.
2018-11-25Add TryFrom<&[T]> for [T; $N] where T: CopySimon Sapin-0/+78
`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`. Also add doc examples doing just that.
2018-11-25fix missing borrowEthan Brierley-1/+1
2018-11-25Use a reference rather than take ownershipEthan Brierley-1/+1
2018-11-25Stabilize the int_to_from_bytes featureSimon Sapin-36/+12
Fixes #52963
2018-11-15Rollup merge of #55901 - euclio:speling, r=petrochenkovPietro Albini-1/+1
fix various typos in doc comments
2018-11-13fix various typos in doc commentsAndy Russell-1/+1
2018-11-12Auto merge of #55278 - Centril:constification-1, r=alexcrichtonbors-17/+15
Minor standard library constification This PR makes some bits of the standard library into `const fn`s. I've tried to be as aggressive as I possibly could in the constification. The list is rather small due to how restrictive `const fn` is at the moment. r? @oli-obk cc @rust-lang/libs Stable public APIs affected: + [x] `Cell::as_ptr` + [x] `UnsafeCell::get` + [x] `char::is_ascii` + [x] `iter::empty` + [x] `ManuallyDrop::{new, into_inner}` + [x] `RangeInclusive::{start, end}` + [x] `NonNull::as_ptr` + [x] `{[T], str}::as_ptr` + [x] `Duration::{as_secs, subsec_millis, subsec_micros, subsec_nanos}` + [x] `CStr::as_ptr` + [x] `Ipv4Addr::is_unspecified` + [x] `Ipv6Addr::new` + [x] `Ipv6Addr::octets` Unstable public APIs affected: + [x] `Duration::{as_millis, as_micros, as_nanos, as_float_secs}` + [x] `Wrapping::{count_ones, count_zeros, trailing_zeros, rotate_left, rotate_right, swap_bytes, reverse_bits, from_be, from_le, to_be, to_le, leading_zeros, is_positive, is_negative, leading_zeros}` + [x] `core::convert::identity` -------------------------- ## Removed from list in first pass: Stable public APIs affected: + [ ] `BTree{Map, Set}::{len, is_empty}` + [ ] `VecDeque::is_empty` + [ ] `String::{is_empty, len}` + [ ] `FromUtf8Error::utf8_error` + [ ] `Vec<T>::{is_empty, len}` + [ ] `Layout::size` + [ ] `DecodeUtf16Error::unpaired_surrogate` + [ ] `core::fmt::{fill, width, precision, sign_plus, sign_minus, alternate, sign_aware_zero_pad}` + [ ] `panic::Location::{file, line, column}` + [ ] `{ChunksExact, RChunksExact}::remainder` + [ ] `Utf8Error::valid_up_to` + [ ] `VacantEntry::key` + [ ] `NulError::nul_position` + [ ] `IntoStringError::utf8_error` + [ ] `IntoInnerError::error` + [ ] `io::Chain::get_ref` + [ ] `io::Take::{limit, get_ref}` + [ ] `SocketAddrV6::{flowinfo, scope_id}` + [ ] `PrefixComponent::{kind, as_os_str}` + [ ] `Path::{ancestors, display}` + [ ] `WaitTimeoutResult::timed_out` + [ ] `Receiver::{iter, try_iter}` + [ ] `thread::JoinHandle::thread` + [ ] `SystemTimeError::duration` Unstable public APIs affected: + [ ] `core::fmt::Arguments::new_v1` + [ ] `core::fmt::Arguments::new_v1_formatted` + [ ] `Pin::{get_ref, into_ref}` + [ ] `Utf8Lossy::chunks` + [ ] `LocalWaker::as_waker` + [ ] `panic::PanicInfo::{internal_constructor, message, location}` + [ ] `panic::Location::{internal_constructor }` ## Removed from list in 2nd pass: Stable public APIs affected: + [ ] `LinkedList::{new, iter, is_empty, len}` + [ ] `mem::forget` + [ ] `Cursor::{new, get_ref, position}` + [ ] `io::{empty, repeat, sink}` + [ ] `PoisonError::new` + [ ] `thread::Builder::new` + [ ] `process::Stdio::{piped, inherit, null}` Unstable public APIs affected: + [ ] `io::Initializer::{zeroing, should_initialize}`
2018-11-11Rollup merge of #55828 - oli-obk:promotion_strikes_again, r=eddybPietro Albini-0/+2
Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value` cc @pnkfelix fixes #55806
2018-11-10revert making internal APIs const fn.Mazdak Farrokhzad-5/+5
2018-11-10constify parts of libcore.Mazdak Farrokhzad-22/+20
2018-11-09Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`Oliver Scherer-0/+2
2018-11-07add unstable attributeEthan Brierley-0/+4
2018-11-07Fix incorrect documentationEthan Brierley-2/+2
2018-11-07Use method rather than public fieldEthan Brierley-2/+5
2018-11-06Document kind fieldEthan Brierley-0/+1
2018-11-06Fix mistake in my markdownEthan Brierley-0/+2
2018-11-06Add very useful documentationEthan Brierley-0/+8
2018-11-05Continue to try to make travis happy by adding a issue numberEthan Brierley-1/+2
2018-11-05break line to keep `travis_fold:start:tidy` happyEthan Brierley-1/+2
2018-11-05Add useful attributesEthan Brierley-0/+3
2018-11-05Make `ParseIntError` and `IntErrorKind` fully publicEthan Brierley-2/+2
2018-11-03Implement rotate using funnel shift on LLVM >= 7Nikita Popov-2/+12
Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore.
2018-10-31Bump nightly to 1.32.0Alex Crichton-2/+2
* Also update the bootstrap compiler * Update cargo to 1.32.0 * Clean out stage0 annotations
2018-10-03Only promote calls to `#[rustc_promotable]` const fnsOliver Schneider-0/+2
2018-09-30Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrumbors-405/+1
Bump to 1.31.0 and bootstrap from 1.30 beta Closes #54594.
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-405/+1
2018-09-17introduce from_nonzero featurecsmoe-1/+1
2018-09-15implement From<NonZero<Int>> for Intcsmoe-0/+7
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.