about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2017-07-30Document the `from_str_radix` panicTobias Bucher-0/+4
CC #42034
2017-07-29Rollup merge of #43409 - tshepang:concise, r=steveklabnikMark Simulacrum-25/+8
doc: make into_iter example more concise Also, remove dupe example
2017-07-27Use `rustc_on_unimplemented`'s trait name argument in `try`Esteban Küber-1/+1
2017-07-26Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturonbors-37/+29
Stabilize more APIs for the 1.20.0 release In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
2017-07-26Rollup merge of #43471 - ollie27:try_from_ints, r=nagisaMark Simulacrum-15/+30
Add missing impl and tests for int to int TryFrom impls These were missing from #43248. r? @nagisa
2017-07-26Rollup merge of #42959 - SimonSapin:nonzero-checked, r=sfacklerMark Simulacrum-29/+130
Make the "main" constructors of NonZero/Shared/Unique return Option Per discussion in https://github.com/rust-lang/rust/issues/27730#issuecomment-303939441. This is a breaking change to unstable APIs. The old behavior is still available under the name `new_unchecked`. Note that only that one can be `const fn`, since `if` is currently not allowed in constant contexts. In the case of `NonZero` this requires adding a new `is_zero` method to the `Zeroable` trait. I mildly dislike this, but it’s not much worse than having a `Zeroable` trait in the first place. `Zeroable` and `NonZero` are both unstable, this can be reworked later.
2017-07-25Auto merge of #43320 - alexcrichton:new-bootstrap, r=Mark-Simulacrumbors-40/+10
Bump master to 1.21.0 This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-25std: Stabilize the `str_{mut,box}_extras` featureAlex Crichton-3/+3
Stabilizes * `<&mut str>::as_bytes_mut` * `<Box<str>>::into_boxed_bytes` * `std::str::from_boxed_utf8_unchecked` * `std::str::from_utf8_mut` * `std::str::from_utf8_unchecked_mut` Closes #41119
2017-07-25Stabilize the `compile_error_macro` featureAlex Crichton-1/+1
Stabilizes: * `compile_error!` as a macro defined by rustc Closes #40872
2017-07-25std: Stabilize `manually_drop` featureAlex Crichton-10/+7
Stabilizes * `core::mem::ManuallyDrop` * `std::mem::ManuallyDrop` * `ManuallyDrop::new` * `ManuallyDrop::into_inner` * `ManuallyDrop::drop` * `Deref for ManuallyDrop` * `DerefMut for ManuallyDrop` Closes #40673
2017-07-25std: Stabilize `utf8_error_error_len` featureAlex Crichton-1/+1
Stabilizes: * `Utf8Error::error_len` Closes #40494
2017-07-25std: Stabilize `str_checked_slicing` featureAlex Crichton-10/+10
Stabilized * `<str>::get` * `<str>::get_mut` * `<str>::get_unchecked` * `<str>::get_unchecked_mut` Closes #39932
2017-07-25std: Stabilize `option_entry` featureAlex Crichton-6/+2
Stabilized: * `Option::get_or_insert` * `Option::get_or_insert_with` Closes #39288
2017-07-25std: Stabilize `char_escape_debug`Alex Crichton-6/+5
Stabilizes: * `<char>::escape_debug` * `std::char::EscapeDebug` Closes #35068
2017-07-25Bump master to 1.21.0Alex Crichton-40/+10
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-25Add missing impl and tests for int to int TryFrom implsOliver Middleton-15/+30
2017-07-25Auto merge of #43325 - ollie27:overflowing_literals, r=arielb1bors-5/+1
Fix overflowing_literals lint for large f32s Float literals need to be parsed as the correct type so they can be rounded correctly.
2017-07-25Auto merge of #43248 - llogiq:num-try-from, r=nagisabors-38/+391
improve the TryFrom implementations This removes the need for a 128 bit storage by making use of the fact that there can be either no over/underflow, either one or both, and each time the target type suffices to hold the limit for comparison. This also means that the implementation will work in targets without 128bit support (unless it's for 128bit types, of course). The downside is that the code looks a bit more complex.
2017-07-24doc: make into_iter example more conciseTshepang Lekhonkhobe-25/+8
2017-07-24improve the TryFrom implementationsAndre Bogus-38/+391
This removes the need for a 128 bit storage by making use of the fact that there can be either no over/underflow, either one or both, and each time the target type suffices to hold the limit for comparison. The downside is that the code looks a bit more complex. This test code included in this commit is from @oyvindln 's PR. They also greatly helped fixing a number of errors I made along the way. Thanks a lot!
2017-07-24Rollup merge of #43428 - waywardmonkeys:doc-fixes, r=estebankMark Simulacrum-4/+4
Fix some doc/comment typos.
2017-07-24Auto merge of #43413 - mandeep:ops-generics, r=alexcrichtonbors-0/+36
Add generic example of std::ops::Sub in doc comments This PR adds an example of using generics with std::ops::Sub and is a follow up of PR #41612 and is related to issue #29365. I also wanted to add examples to Mul and Div, but I think these two traits are already loaded with examples.
2017-07-23Fix some doc/comment typos.Bruce Mitchener-4/+4
2017-07-23Auto merge of #43416 - tshepang:extra-layer, r=alexcrichtonbors-6/+5
doc: provide an actual equivalent to filter_map
2017-07-23Auto merge of #43406 - canndrew:never-impl-clone, r=alexcrichtonbors-0/+1
Add missing `!: Clone` impl Fixes #43296 (untested because I'm having computer troubles, but a one-liner can't break anything right?)
2017-07-22doc: provide an actual equivalent to filter_mapTshepang Lekhonkhobe-6/+5
2017-07-22Fix unstable feature name for some impls for Unique<T>Simon Sapin-2/+2
2017-07-22Add conversions from references to NonZero pointers, Unique, and SharedSimon Sapin-0/+47
2017-07-22Implement From<Unique<T>> for Shared<T>Simon Sapin-0/+8
2017-07-22Rename {NonZero,Shared,Unique}::new_checked to newSimon Sapin-5/+5
2017-07-22Rename {NonZero,Shared,Unique}::new to new_uncheckedSimon Sapin-11/+11
2017-07-22Add `new_checked(…) -> Option<Self>` to NonZero, Unique, and Shared.Simon Sapin-19/+65
2017-07-22Add generic example of std::ops::Sub in doc commentsmandeep-0/+36
2017-07-22Auto merge of #43367 - alexcrichton:remove-inline-always, r=sfacklerbors-50/+50
std: Cut down #[inline] annotations where not necessary This PR cuts down on a large number of `#[inline(always)]` and `#[inline]` annotations in libcore for various core functions. The `#[inline(always)]` annotation is almost never needed and is detrimental to debug build times as it forces LLVM to perform inlining when it otherwise wouldn't need to in debug builds. Additionally `#[inline]` is an unnecessary annoation on almost all generic functions because the function will already be monomorphized into other codegen units and otherwise rarely needs the extra "help" from us to tell LLVM to inline something. Overall this PR cut the compile time of a [microbenchmark][1] by 30% from 1s to 0.7s. [1]: https://gist.github.com/alexcrichton/a7d70319a45aa60cf36a6a7bf540dd3a
2017-07-22Add !: Clone implAndrew Cann-0/+1
2017-07-20std: Cut down #[inline] annotations where not necessaryAlex Crichton-50/+50
This PR cuts down on a large number of `#[inline(always)]` and `#[inline]` annotations in libcore for various core functions. The `#[inline(always)]` annotation is almost never needed and is detrimental to debug build times as it forces LLVM to perform inlining when it otherwise wouldn't need to in debug builds. Additionally `#[inline]` is an unnecessary annoation on almost all generic functions because the function will already be monomorphized into other codegen units and otherwise rarely needs the extra "help" from us to tell LLVM to inline something. Overall this PR cut the compile time of a [microbenchmark][1] by 30% from 1s to 0.7s. [1]: https://gist.github.com/alexcrichton/a7d70319a45aa60cf36a6a7bf540dd3a
2017-07-19Auto merge of #42859 - eddyb:const-size-and-align-of, r=nikomatsakisbors-0/+43
Implement const fn {size,align}_of. Fixes #34078. r? @nikomatsakis
2017-07-19Implement const fn {size,align}_of.Eduard-Mihai Burtescu-0/+43
2017-07-19Fix overflowing_literals lint for large f32sOliver Middleton-5/+1
Float literals need to be parsed as the correct type so they can be rounded correctly.
2017-07-18Rollup merge of #43292 - kennytm:fix-quasi-quoting-warning-in-rustbuild, ↵Mark Simulacrum-1/+1
r=alexcrichton Workaround "Quasi-quoting is inefficient" warning in incremental rustbuild introduced in #43252. After #43252 is merged, building stage0 libcore with `-i` (`--incremental`) flag will cause 17 "Quasi-quoting might make incremental compilation very inefficient: NtExpr(..)" warnings, as in #40946. ``` warning: Quasi-quoting might make incremental compilation very inefficient: NtExpr(..) --> src/libcore/default.rs:133:21 | 133 | #[doc = $doc] | ^^^^ ... 139 | default_impl! { (), (), "Returns the default value of `()`" } | ------------------------------------------------------------- in this macro invocation (× 17) ``` True fix for #40946 will take at least 12 weeks from now to make into the next stage0, so it is quicker to workaround it in libcore instead. cc @vbrandl @jseyfried
2017-07-18Rollup merge of #42837 - rthomas:29355-error, r=steveklabnikMark Simulacrum-0/+16
Update docs on Error struct. #29355 This adds a pretty contrived example of the usage of fmt::Error. I am very open to suggestions for a better one. I have also highlighted the fmt::Error vs std::error::Error. r? @steveklabnik
2017-07-18Fix "Quasi-quoting is inefficient" warning in incremental rustbuild.kennytm-1/+1
After #43252 is merged, building stage0 libcore with -i (--incremental) flag will cause 17 "Quasi-quoting might make incremental compilation very inefficient: NtExpr(..)" warnings, as in #40946. Fixing the warning in #40946 will take 12 weeks from now to make into the next stage0, so it is quicker to workaround it in libcore instead.
2017-07-16Auto merge of #43237 - ↵bors-1/+1
zackmdavis:missing_sum_and_product_for_128_bit_integers, r=nagisa add u128/i128 to sum/product implementors Resolves #43235.
2017-07-16Auto merge of #43252 - vbrandl:doc/default-values, r=GuillaumeGomezbors-18/+19
Document default values for primitive types All primitive types implement the `Default` trait but the documentation just says `Returns the "default value" for a type.` and doesn't give a hint about the actual default value. I think it would be good to document the default values in a proper way. I changed the `default_impl` macro to accept a doc string as a third parameter and use this string to overwrite the documentation of `default()` for each primitive type. The generated documentation now looks like this: ![Documentation of default() on the bool primitive](https://i.imgur.com/nK6TApo.png)
2017-07-15Rephrase the doc stringValentin Brandl-17/+17
2017-07-15Document default values for primitive typesValentin Brandl-18/+19
2017-07-14Rollup merge of #43159 - cuviper:ptr-swap-simd, r=arielb1Corey Farwell-1/+4
Disable big-endian simd in swap_nonoverlapping_bytes This is a workaround for #42778, which was git-bisected to #40454's optimizations to `mem::swap`, later moved to `ptr` in #42819. Natively compiled rustc couldn't even compile stage1 libcore on powerpc64 and s390x, but they work fine without this `repr(simd)`. Since powerpc64le works OK, it seems probably related to being big-endian. The underlying problem is not yet known, but this at least makes those architectures functional again in the meantime. cc @arielb1
2017-07-14add u128/i128 to sum/product implementorsZack M. Davis-1/+1
Resolves #43235.
2017-07-13Forward more Iterator methods for iter::RevSimon Sapin-0/+8
`position` could not be implemented because calling `rposition` on the inner iterator would require more trait bounds.
2017-07-13Forward more Iterator methods for str::BytesSimon Sapin-0/+38
These are overridden by slice::Iter