summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2018-04-21Revert "Stabilize the TryFrom and TryInto traits"Felix S. Klock II-20/+17
This reverts commit e53a2a72743810e05f58c61c9d8a4c89b712ad2e.
2018-04-21Revert stabilization of `feature(never_type)`.Felix S. Klock II-6/+7
This commit is just covering the feature gate itself and the tests that made direct use of `!` and thus need to opt back into the feature. A follow on commit brings back the other change that motivates the revert: Namely, going back to the old rules for falling back to `()`.
2018-04-21smaller PR just to fix #50002Michael Lamparski-7/+2
2018-04-01Update drop.rsAnders Pitman-1/+1
2018-03-31Auto merge of #49481 - SimonSapin:core-heap, r=alexcrichtonbors-0/+1086
Move the alloc::allocator module to core::heap This is the `Alloc` trait and its dependencies.
2018-03-31Auto merge of #49201 - Phlosioneer:add-trivial-size-hints, r=SimonSapinbors-0/+29
Implement some trivial size_hints for various iterators This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708. I intend to do more, but I don't want to make the PR too large.
2018-03-31Commit code for option size hintPhlosioneer-1/+6
2018-03-30Auto merge of #49324 - SimonSapin:unsigned, r=alexcrichtonbors-7/+24
Deprecate signed std::num::NonZeroI* with a call for use cases CC https://github.com/rust-lang/rust/issues/49137#issuecomment-375823481
2018-03-30Deprecate signed std::num::NonZeroI* with a call for use casesSimon Sapin-7/+24
2018-03-30Revert "Add TryFrom and TryInto to the prelude"Simon Sapin-3/+0
This reverts commit 09008cc23ff6395c2c928f3690e07d7389d08ebc.
2018-03-30Rollup merge of #49473 - joshtriplett:nonnull-size, r=steveklabnikkennytm-1/+1
src/libcore/ptr.rs: Fix documentation for size of `Option<NonNull<T>>` Seems more useful to say that it has the same size as `*mut T`.
2018-03-30Rollup merge of #49446 - frewsxcv:frewsxcv-mention-optiono, r=GuillaumeGomezkennytm-1/+1
Explicitly mention `Option` in `?` error message. Save users the time/effort of having to lookup what types implement the `Try` trait.
2018-03-29Move the alloc::allocator module to core::heapSimon Sapin-0/+1086
This is the `Alloc` trait and its dependencies.
2018-03-29impl RangeBounds<T> for Range{,From,To,Inclusive,ToInclusive}<&T>Simon Sapin-0/+60
2018-03-29Move RangeArguments to {core::std}::ops and rename to RangeBoundsSimon Sapin-2/+155
These unstable items are deprecated: * The `std::collections::range::RangeArgument` reexport * The `std::collections::range` module.
2018-03-29Move alloc::Bound to {core,std}::opsSimon Sapin-1/+52
The stable reexport `std::collections::Bound` is now deprecated. Another deprecated reexport could be added in `alloc`, but that crate is unstable.
2018-03-29src/libcore/ptr.rs: Fix documentation for size of `Option<NonNull<T>>`Josh Triplett-1/+1
Seems more useful to say that it has the same size as `*mut T`.
2018-03-28Explicitly mention `Option` in `?` error message.Corey Farwell-1/+1
Save users the time/effort of having to lookup what types implement the `Try` trait.
2018-03-27Remove TryFrom impls that might become conditionally-infallible with a ↵Simon Sapin-189/+82
portability lint https://github.com/rust-lang/rust/pull/49305#issuecomment-376293243
2018-03-26Add TryFrom and TryInto to the preludeSimon Sapin-0/+3
2018-03-26Stabilize the TryFrom and TryInto traitsSimon Sapin-18/+21
Tracking issue: https://github.com/rust-lang/rust/issues/33417
2018-03-26Don’t use `type Error = !` for target-dependant TryFrom impls.Simon Sapin-1/+1
Instead, expose apparently-fallible conversions in cases where the implementation happens to be infallible for a given target. Having an associated type / return type in a public API change based on the target is a portability hazard.
2018-03-26TryFrom for integers: use From instead for truely-infallible implsSimon Sapin-9/+20
There is precendent in C for having a minimum pointer size, but I don’t feel confident enough about the future to mandate a maximum.
2018-03-26Auto merge of #49101 - mark-i-m:stabilize_i128, r=nagisabors-38/+23
Stabilize 128-bit integers :tada: cc #35118 EDIT: This should be merged only after the following have been merged: - [x] https://github.com/rust-lang-nursery/compiler-builtins/pull/236 - [x] https://github.com/rust-lang/book/pull/1230
2018-03-26fix last two tidyMark Mansi-7/+1
2018-03-26Fix a few more unstables that I missedMark Mansi-2/+2
2018-03-26Fix a few moreMark Mansi-2/+2
2018-03-26Fix missed i128 feature gatesMark Mansi-12/+12
2018-03-26Stabilize i128 feature tooMark Mansi-11/+4
2018-03-26Stabilize i128_typeMark Mansi-6/+4
2018-03-26Rollup merge of #49353 - chisophugis:patch-1, r=Mark-SimulacrumTim Neumann-5/+5
Fix confusing doc for `scan` The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state". I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.
2018-03-26Rollup merge of #49170 - steveklabnik:gh49127, r=nagisaTim Neumann-2/+5
Clarify AcqRel's docs This implied things that are not true. Fixes #49127
2018-03-26Rollup merge of #49103 - glandium:uninitialized, r=cramertjTim Neumann-1/+1
Use an uninitialized buffer in GenericRadix::fmt_int, like in Display::fmt for numeric types The code using a slice of that buffer is only ever going to use bytes that are subsequently initialized.
2018-03-26Stabilize conservative_impl_traitTaylor Cramer-1/+1
2018-03-26Auto merge of #49297 - scottmcm:offset-from, r=dtolnaybors-2/+237
Introduce unsafe offset_from on pointers Adds intrinsics::exact_div to take advantage of the unsafe, which reduces the implementation from ```asm sub rcx, rdx mov rax, rcx sar rax, 63 shr rax, 62 lea rax, [rax + rcx] sar rax, 2 ret ``` down to ```asm sub rcx, rdx sar rcx, 2 mov rax, rcx ret ``` (for `*const i32`) See discussion on the `offset_to` tracking issue https://github.com/rust-lang/rust/issues/41079 Some open questions - Would you rather I split the intrinsic PR from the library PR? - Do we even want the safe version of the API? https://github.com/rust-lang/rust/issues/41079#issuecomment-374426786 I've added some text to its documentation that even if it's not UB, it's useless to use it between pointers into different objects. and todos - [x] ~~I need to make a codegen test~~ Done - [x] ~~Can the subtraction use nsw/nuw?~~ No, it can't https://github.com/rust-lang/rust/pull/49297#discussion_r176697574 - [x] ~~Should there be `usize` variants of this, like there are now `add` and `sub` that you almost always want over `offset`? For example, I imagine `sub_ptr` that returns `usize` and where it's UB if the distance is negative.~~ Can wait for later; C gives a signed result https://github.com/rust-lang/rust/issues/41079#issuecomment-375842235, so we might as well, and this existing to go with `offset` makes sense.
2018-03-25update wording as per feedbackSteve Klabnik-1/+3
2018-03-24Fix confusing doc for `scan`Sean Silva-5/+5
The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state". I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.
2018-03-25Fix incorrect copy-pasted codePhlosioneer-3/+3
It's late.
2018-03-24Fix syntax errorPhlosioneer-1/+1
2018-03-24Fix doctest mutability copy-pastaScott McMurray-2/+2
2018-03-24Documentation and naming improvementsScott McMurray-15/+33
2018-03-24Fix incorrect lower boundsPhlosioneer-2/+12
2018-03-25Rollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakiskennytm-0/+10
Stabilize the copy_closures and clone_closures features In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do. Tracking issue: https://github.com/rust-lang/rust/issues/44490
2018-03-25Rollup merge of #49229 - Centril:doc/format_args_display_debug, r=steveklabnikkennytm-6/+66
Document format_args! / Arguments<'a> behavior wrt. Display and Debug This is a follow up PR to #49067 , this documents the behavior of `format_args!` (i.e: `Argument<'a>`) wrt. `Display` and `Debug`. r? @steveklabnik
2018-03-25Rollup merge of #49194 - Zoxc:unsafe-generator, r=cramertjkennytm-4/+8
Make resuming generators unsafe instead of the creation of immovable generators cc @withoutboats Fixes #47787
2018-03-23Rollup merge of #49102 - glandium:decimal, r=aturonAlex Crichton-5/+0
Remove core::fmt::num::Decimal Before ebf9e1aaf6, it was used for Display::fmt, but ebf9e1aaf6 replaced that with a faster implementation, and nothing else uses it.
2018-03-23Rollup merge of #48265 - SimonSapin:nonzero, r=KodrAusAlex Crichton-34/+153
Add 12 num::NonZero* types for primitive integers, deprecate core::nonzero RFC: https://github.com/rust-lang/rfcs/pull/2307 Tracking issue: ~~https://github.com/rust-lang/rust/issues/27730~~ https://github.com/rust-lang/rust/issues/49137 Fixes https://github.com/rust-lang/rust/issues/27730
2018-03-23Mention closures in docs for Clone and CopySimon Sapin-0/+10
2018-03-23Introduce unsafe offset_from on pointersScott McMurray-0/+217
Adds intrinsics::exact_div to take advantage of the unsafe, which reduces the implementation from ```asm sub rcx, rdx mov rax, rcx sar rax, 63 shr rax, 62 lea rax, [rax + rcx] sar rax, 2 ret ``` down to ```asm sub rcx, rdx sar rcx, 2 mov rax, rcx ret ``` (for `*const i32`)
2018-03-22Rollup merge of #49038 - canndrew:replace-infallible-with-never, r=SimonSapinkennytm-29/+9
replace `convert::Infallible` with `!`