about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
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-26Implement RFC #2169 (Euclidean division).Fabian Zaiser-0/+436
Tracking issue: #49048
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 `!`
2018-03-22Rollup merge of #49105 - SimonSapin:from_utf8_lossy_example, r=alexcrichtonkennytm-0/+31
Add an example of lossy decoding to str::Utf8Error docs CC https://github.com/rust-lang/rust/issues/33906
2018-03-22Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebankkennytm-3/+3
address some FIXME whose associated issues were marked as closed part of #44366
2018-03-22Rollup merge of #49109 - SimonSapin:deprecate-asciiext, r=alexcrichtonkennytm-3/+0
Deprecate the AsciiExt trait in favor of inherent methods The trait and some of its methods are stable and will remain. Some of the newer methods are unstable and can be removed later. Fixes https://github.com/rust-lang/rust/issues/39658
2018-03-22Rollup merge of #49029 - GuillaumeGomez:atomic-docs, r=QuietMisdreavuskennytm-364/+401
Make Atomic doc examples specific to each type Fixes #49018. r? @QuietMisdreavus
2018-03-22document format_args! - fix trailing whitespaceMazdak Farrokhzad-1/+1
2018-03-21Deprecate the AsciiExt trait in favor of inherent methodsSimon Sapin-3/+0
The trait and some of its methods are stable and will remain. Some of the newer methods are unstable and can be removed later. Fixes https://github.com/rust-lang/rust/issues/39658
2018-03-21document format_args! behavior wrt. Display and DebugMazdak Farrokhzad-6/+66
2018-03-21Make resuming generators unsafe instead of the creation of immovable ↵John Kåre Alsaker-4/+8
generators. Fixes #47787
2018-03-20Auto merge of #49190 - kennytm:rollup, r=kennytmbors-32/+473
Rollup of 17 pull requests - Successful merges: #46518, #48810, #48834, #48902, #49004, #49092, #49096, #49099, #49104, #49125, #49139, #49152, #49157, #49161, #49166, #49176, #49184 - Failed merges:
2018-03-20Implement some trivial size_hints for various iteratorsPhlosioneer-0/+14
This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708.
2018-03-20Auto merge of #48516 - petrochenkov:stabsl, r=nikomatsakisbors-1/+1
Stabilize slice patterns without `..` And merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`. The detailed description can be found in https://github.com/rust-lang/rust/issues/48836. Slice patterns were unstable for long time since before 1.0 due to many bugs in the implementation, now this stabilization is possible primarily due to work of @arielb1 who [wrote the new MIR-based implementation of slice patterns](https://github.com/rust-lang/rust/pull/32202) and @mikhail-m1 who [fixed one remaining class of codegen issues](https://github.com/rust-lang/rust/pull/47926). Reference PR https://github.com/rust-lang-nursery/reference/pull/259 cc https://github.com/rust-lang/rust/issues/23121 fixes #48836
2018-03-20Stabilize slice patterns without `..`Vadim Petrochenkov-1/+1
Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`
2018-03-20Rollup merge of #49099 - glandium:master, r=sfacklerkennytm-17/+15
Use associated consts for GenericRadix base and prefix The trait being private, this does not imply an API change.
2018-03-20Rollup merge of #48810 - Phlosioneer:32463-impl-integer-for-wrapping, r=dtolnaykennytm-0/+309
Implement Integer methods for Wrapping Wrapping<T> now implements: count_ones, count_zeros, leading_zeros, trailing_zeros, rotate_left, rotate_right, swap_bytes, from_be, from_le, to_be, to_le, and pow where T is: u8, u16, u32, u64, usize, i8, i16, i32, i64, or isize. Docs were written for all these methods, as well as examples. The examples mirror the ones on u8, u16, etc... for consistency. Closes #32463
2018-03-20Rollup merge of #46518 - partim:asref-borrow-doc, r=dtolnaykennytm-15/+149
Improve documentation for Borrow This is the first step in improving the documentation for all the reference conversion traits. It proposes new text for the trait documentation of `Borrow`. Since I feel it is a somewhat radical rewrite and includes a stricter contract for `Borrow` then the previous text—namely that *all* shared traits need to behave the same, not just a select few—, I wanted to get some feedback before continuing. Apart from the ‘normative’ description, the new text also includes a fairly extensive explanation of how the trait is used in the examples section. I included it because every time I look at how `HashMap` uses the trait, I need to think for a while as the use is a bit twisted. So, I thought having this thinking written down as part of the trait itself might be useful. One could argue that this should go into The Book, and, while I really like having everything important in the docs, I can see the text moved there, too. So, before I move on: is this new text any good? Do we feel it is correct, useful, comprehensive, and understandable? (This PR is in response to #44868 and #24140.)
2018-03-19Auto merge of #49058 - withoutboats:pin, r=cramertjbors-2/+120
Pin, Unpin, PinBox Implementing rust-lang/rfcs#2349 (do not merge until RFC is merged) @bors r? @cramertj
2018-03-19Make Atomic doc examples specific to each typeGuillaume Gomez-364/+401
2018-03-19Clarify AcqRel's docssteveklabnik-2/+3
This implied things that are not true. Fixes #49127