summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2017-03-17Minor fixups to fix tidy errorsAlex Crichton-2/+1
2017-03-17Stabilize rc_raw feature, closes #37197Aaron Turon-3/+11
2017-03-17Stabilize ordering_chaining, closes #37053Aaron Turon-6/+2
2017-03-17Stabilize ptr_unaligned feature, closes #37955Aaron Turon-6/+2
2017-03-17Stabilize expect_err feature, closes #39041Aaron Turon-2/+1
2017-03-17Stabilize move_cell feature, closes #39264Aaron Turon-8/+4
2017-03-13Fix a typo in Rev docsStjepan Glavina-1/+1
2017-03-11Rollup merge of #40299 - GuillaumeGomez:fmt-display-example, r=frewsxcvAriel Ben-Yehuda-1/+20
Add missing example for Display::fmt r? @frewsxcv
2017-03-10Add missing example for Display::fmtGuillaume Gomez-1/+20
2017-03-08Rollup merge of #40333 - tbu-:pr_doc_ptr_write, r=alexcrichtonAriel Ben-Yehuda-0/+4
Clarify handling of `src` in `ptr::write` Fixes #39733.
2017-03-07Clarify handling of `src` in `ptr::write`Tobias Bucher-0/+4
Fixes #39733.
2017-03-07Add missing urls in some macros docGuillaume Gomez-7/+16
2017-03-01Only keep one copy of the UTF8_CHAR_WIDTH table.Simon Sapin-0/+7
… instead of one of each of libcore and libstd_unicode. Move the `utf8_char_width` function to `core::str` under the `str_internals` unstable feature.
2017-02-28Rollup merge of #40126 - GuillaumeGomez:fmt-write-docs, r=frewsxcvCorey Farwell-9/+62
Add missing docs and examples for fmt::Write r? @frewsxcv
2017-02-28Add missing docs and examples for fmt::WriteGuillaume Gomez-9/+62
2017-02-24Rollup merge of #39886 - mbrubeck:doc-edit, r=steveklabnikGuillaume Gomez-0/+16
Additional docs for Vec, String, and slice trait impls r? @steveklabnik
2017-02-21Get linkchecker cleanSteve Klabnik-7/+7
This affects the book, some missed things in the reference, the grammar, and the standard library. Whew!
2017-02-20Revert "Fix up links"Steve Klabnik-2/+2
This reverts commit 7f1d1c6d9a7be5e427bace30e740b16b25f25c92. The original commit was created because mdBook and rustdoc had different generation algorithms for header links; now with https://github.com/rust-lang/rust/pull/39966 , the algorithms are the same. So let's undo this change. ... when I came across this problem, I said "eh, this isn't fun, but it doesn't take that long." I probably should have just actually taken the time to fix upstream, given that they were amenable. Oh well!
2017-02-19Docs: Better explanation of return values for min, max functionsMikhail Pak-6/+22
Explain that a None is returned if the iterator is empty.
2017-02-17code order tweakking6cong-3/+3
2017-02-16Additional docs for Vec, String, and slice trait implsMatt Brubeck-0/+16
2017-02-15Rollup merge of #39793 - RalfJung:cell, r=alexcrichtonCorey Farwell-62/+62
Allow more Cell methods for non-Copy types Clearly, `get_mut` is safe for any `T`. The other two only provide unsafe pointers anyway. The only remaining inherent method with `Copy` bound is `get`, which sounds about right to me. I found the order if `impl` blocks in the file a little weird (first inherent impl, then some trait impls, then another inherent impl), but didn't change it to keep the diff small. Contributes to #39264
2017-02-15Auto merge of #39633 - steveklabnik:vendor-mdbook, r=alexcrichtonbors-2/+2
Port books to mdbook Part of https://github.com/rust-lang/rust/issues/39588 blocked on https://github.com/rust-lang/rust/pull/39431 As a first step towards the bookshelf, we ~vendor mdbook in-tree and~ port our books to it. Eventually, both of these books will be moved out-of-tree, but the nightly book will rely on doing the same thing. As such, this intermediate step is useful. r? @alexcrichton @brson /cc @azerupi
2017-02-14Remove Copy bound from some Cell trait implsRalf Jung-2/+2
Contributes to #39264
2017-02-14Auto merge of #38981 - sdleffler:patch-1, r=alexcrichtonbors-1/+5
Add PartialOrd, Ord derivations to TypeId I want to be able to sort a `Vec` of types which contain `TypeId`s, so an `Ord` derivation would be very useful to me. `Hash` and `PartialEq`/`Eq` already exist, so the missing `PartialOrd` and `Ord` derivations feel like an oversight to me.
2017-02-13Allow more Cell methods for non-Copy typesRalf Jung-60/+60
Contributes to #39264
2017-02-13Fix up linksSteve Klabnik-2/+2
mdbook and rustdoc generate links differently, so we need to change all these links.
2017-02-13Rollup merge of #39716 - F001:swapCell, r=alexcrichtonCorey Farwell-0/+27
Add `swap` method for `Cell` Addition to #39264 r? @alexcrichton
2017-02-12Fix some typos in the core::fmt docs.Ahmed Charles-2/+2
2017-02-12Rollup merge of #39756 - JordiPolo:feature/try_to_question, r=steveklabnikGuillaume Gomez-23/+15
Sustitutes try! for ? in the Result documentation Hopefully newcomers will go strait to use `?`
2017-02-12Auto merge of #39554 - ↵bors-6/+6
zackmdavis:assert_eq_has_a_terrible_error_message_when_given_a_trailing_comma, r=BurntSushi improve error message when two-arg assert_eq! receives a trailing comma Previously, `assert_eq!(left, right,)` (respectively, `assert_ne!(left, right,)`; note the trailing comma) would result in a confusing "requires at least a format string argument" error. In reality, a format string is optional, but the trailing comma puts us into the "match a token tree of zero or more tokens" branch of the macro (in order to support the optional format string), and passing the empty token tree into `format_args!` results in the confusing error. If instead we match a token tree of one or more tokens, we get a much more sensible "unexpected end of macro invocation" error. While we're here, fix up a stray space before a comma in the match guards. Resolves #39369. ----- **Before:** ``` $ rustc scratch.rs error: requires at least a format string argument --> scratch.rs:2:5 | 2 | assert_eq!(1, 2,); | ^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate error: aborting due to previous error ``` **After:** ``` $ ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc scratch.rs error: unexpected end of macro invocation --> scratch.rs:2:20 | 2 | assert_eq!(1, 2,); | ^ ```
2017-02-12Sustitutes try! for ? in the Result documentationJordi Polo-23/+15
2017-02-11Auto merge of #39736 - frewsxcv:rollup, r=frewsxcvbors-2/+5
Rollup of 9 pull requests - Successful merges: #39174, #39660, #39676, #39692, #39701, #39710, #39721, #39724, #39725 - Failed merges:
2017-02-11Add `swap` method for `Cell`Charlie Fan-0/+27
2017-02-10Rollup merge of #39174 - rspeer:iter-nth-doc-fix, r=alexcrichtonCorey Farwell-2/+5
Fix a misleading statement in `Iterator.nth()` The `Iterator.nth()` documentation says "Note that all preceding elements will be consumed". I assumed from that that the preceding elements would be the *only* ones that were consumed, but in fact the returned element is consumed as well. The way I read the documentation, I assumed that `nth(0)` would not discard anything (there are 0 preceding elements, and maybe it just peeks at the start of the iterator somehow), so I added a sentence clarifying that it does. I also rephrased it to avoid the stunted "i.e." phrasing.
2017-02-11Auto merge of #39642 - stjepang:specialize-slice-partialord, r=alexcrichtonbors-3/+4
Specialize `PartialOrd<A> for [A] where A: Ord` This way we can call `cmp` instead of `partial_cmp` in the loop, removing some burden of optimizing `Option`s away from the compiler. PR #39538 introduced a regression where sorting slices suddenly became slower, since `slice1.lt(slice2)` was much slower than `slice1.cmp(slice2) == Less`. This problem is now fixed. To verify, I benchmarked this simple program: ```rust fn main() { let mut v = (0..2_000_000).map(|x| x * x * x * 18913515181).map(|x| vec![x, x ^ 3137831591]).collect::<Vec<_>>(); v.sort(); } ``` Before this PR, it would take 0.95 sec, and now it takes 0.58 sec. I also tried changing the `is_less` lambda to use `cmp` and `partial_cmp`. Now all three versions (`lt`, `cmp`, `partial_cmp`) are equally performant for sorting slices - all of them take 0.58 sec on the benchmark. Tangentially, as soon as we get `default impl`, it might be a good idea to implement a blanket default impl for `lt`, `gt`, `le`, `ge` in terms of `cmp` whenever possible. Today, those four functions by default are only implemented in terms of `partial_cmp`. r? @alexcrichton
2017-02-10iterator docs: Move paragraph about discarding; clarify "consumed"Rob Speer-5/+5
2017-02-10Rephrase my proposed edit ("objects" -> "elements")Rob Speer-1/+1
2017-02-10Fix a misleading statement in `Iterator.nth()`Rob Speer-1/+4
The `Iterator.nth()` documentation says "Note that all preceding elements will be consumed". I assumed from that that the preceding elements would be the *only* ones that were consumed, but in fact the returned element is consumed as well. The way I read the documentation, I assumed that `nth(0)` would not discard anything (as there are 0 preceding elements), so I added a sentence clarifying that it does. I also rephrased it to avoid the stunted "i.e." phrasing.
2017-02-09name anonymous fn parameters in libcore traitsTrevor Spiteri-22/+22
2017-02-09Rollup merge of #39615 - phungleson:corefloat, r=alexcrichtonCorey Farwell-83/+98
Improve format float * Move float into mod float like in test * Add more tests for f64 f32, lower exp, upper exp, which can come if handy in the future if we want refactor further * Use `assert_eq` for clearer error messages
2017-02-08Remove unnecessary specialization for [u8]Stjepan Glavina-7/+0
2017-02-08Rollup merge of #39561 - phungleson:libcollectionsbench, r=alexcrichtonCorey Farwell-2/+2
Extract collections benchmarks to libcollections/bench Good suggestion from @stjepang https://github.com/rust-lang/rust/issues/39484#issuecomment-277467765 r? @alexcrichton
2017-02-08Simplify by calling SliceOrd::compareStjepan Glavina-15/+1
2017-02-08Specialize `PartialOrd<A> for [A] where A: Ord`Stjepan Glavina-0/+22
This way we can call `cmp` instead of `partial_cmp` in the loop, removing some burden of optimizing `Option`s away from the compiler. PR #39538 introduced a regression where sorting slices suddenly became slower, since `slice1.lt(slice2)` was much slower than `slice1.cmp(slice2) == Less`. This problem is now fixed. To verify, I benchmarked this simple program: ```rust fn main() { let mut v = (0..2_000_000).map(|x| x * x * x * 18913515181).map(|x| vec![x, x ^ 3137831591]).collect::<Vec<_>>(); v.sort(); } ``` Before this PR, it would take 0.95 sec, and now it takes 0.58 sec. I also tried changing the `is_less` lambda to use `cmp` and `partial_cmp`. Now all three versions (`lt`, `cmp`, `partial_cmp`) are equally performant for sorting slices - all of them take 0.58 sec on the benchmark.
2017-02-07Improve fmt floatSon-83/+98
* Move to a separate float mod * Add more tests for f64 f32 lower exp upper exp * Use assert_eq for a clearer error message
2017-02-06improve error message when two-arg assert_eq! receives a trailing commaZack M. Davis-6/+6
Previously, `assert_eq!(left, right,)` (respectively, `assert_ne!(left, right,)`; note the trailing comma) would result in a confusing "requires at least a format string argument" error. In reality, a format string is optional, but the trailing comma puts us into the "match a token tree of zero or more tokens" branch of the macro (in order to support the optional format string), and passing the empty token tree into `format_args!` results in the confusing error. If instead we match a token tree of one or more tokens, we get a much more sensible "unexpected end of macro invocation" error. While we're here, fix up a stray space before a comma in the match guards. Resolves #39369.
2017-02-06Revert "Add 128-bit atomics"Alex Crichton-18/+0
This reverts commit 9903975003276cc42a1ed5f21eee292b7c62c331.
2017-02-06Extract collections benchmarks to libcollections/benchesSon-2/+2
And libcore/benches
2017-02-05Auto merge of #39567 - frewsxcv:rollup, r=frewsxcvbors-4/+664
Rollup of 12 pull requests - Successful merges: #39439, #39472, #39481, #39491, #39501, #39509, #39514, #39519, #39526, #39528, #39530, #39538 - Failed merges: