about summary refs log tree commit diff
path: root/src/libcore/num
AgeCommit message (Collapse)AuthorLines
2018-12-28Make the getter for NonZero types into a const fndylan_DPC-1/+1
2018-12-26Remove the private generic NonZero<T> wrapper type.Simon Sapin-6/+6
Instead, use `#[rustc_layout_scalar_valid_range_start(1)]` directly on relevant libcore types.
2018-12-25Remove licensesMark Rousskov-310/+0
2018-12-22Update src/libcore/num/dec2flt/mod.rsMazdak Farrokhzad-1/+3
Co-Authored-By: frewsxcv <coreyf@rwell.org>
2018-12-22Update regex to EBNFCorey Farwell-10/+8
2018-12-20fix nitsNicole Mazzuca-2/+4
2018-12-20Update src/libcore/num/mod.rsDavid Tolnay-1/+1
Co-Authored-By: ubsan <npmazzuca@gmail.com>
2018-12-17rename div_euc -> div_euclid, and mod_euc -> rem_euclidNicole Mazzuca-76/+96
logic is written up in https://github.com/rust-lang/rust/issues/49048 Also, update the documentation slightly
2018-12-16Rollup merge of #56855 - nikic:remove-cttz-hack, r=nagisaMazdak Farrokhzad-14/+1
Remove u8 cttz hack This issue has since been fixed in LLVM: https://github.com/llvm-mirror/llvm/commit/1886c8e29a9992d73c5e6ba0d52eb98ee036ab5d Furthermore this code doesn't actually work, because the 8 literal does not match the $BITS provided from the macro invocation, so effectively this was just dead code. Ref #43024. What LLVM does is still not ideal for CPUs that only have bsf but not tzcnt, will create a patch for that later. r? @nagisa
2018-12-16Rollup merge of #56706 - oli-obk:const_unsafe_fn, r=CentrilMazdak Farrokhzad-1/+1
Make `const unsafe fn` bodies `unsafe` r? @Centril Updated for tracking issue discussion https://github.com/rust-lang/rust/issues/55607#issuecomment-445882296
2018-12-15Remove u8 cttz hackNikita Popov-14/+1
This issue has since been fixed in LLVM: https://github.com/llvm-mirror/llvm/commit/1886c8e29a9992d73c5e6ba0d52eb98ee036ab5d Furthermore this doesn't actually work, because the "8" literal does not match the $BITS provided from the macro invocation, so effectively this code was not being used anyway...
2018-12-12Bump to 1.33.0Alex Crichton-12/+2
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-11Make `const unsafe fn` bodies `unsafe`Oliver Scherer-1/+1
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-24/+24
2018-12-04Make sure the initialization of constrained int range newtypes is unsafeOliver Scherer-2/+2
2018-12-03...and fix a linkCorey Farwell-1/+1
2018-12-03tweak 'known issues' wordingCorey Farwell-2/+2
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-25Add grammar for {f32,f64}::from_str, mention known bug.Corey Farwell-1/+25
- Original bug about documenting grammar - https://github.com/rust-lang/rust/issues/32243 - Known bug with parsing - https://github.com/rust-lang/rust/issues/31407
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