about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2017-03-19Rollup merge of #40281 - jimmycuadra:try-from-from-str, r=aturonCorey Farwell-13/+28
Rename TryFrom's associated type and implement str::parse using TryFrom. Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err". See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968. `TryFrom<&str>` and `FromStr` are equivalent, so have the latter provide the former to ensure that. Using `TryFrom` in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to suggest implementing `TryFrom<&str>` instead for new code. See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994 and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827. Refs #33417.
2017-03-19Rollup merge of #40241 - Sawyer47:fix-39997, r=alexcrichtonCorey Farwell-1/+5
Change how the `0` flag works in format! Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. This also affects the '#' flag: zeroes are placed after the prefix (0b, 0o, 0x) and before the digits. Here's a short summary of how similar format strings work in Python and Rust: ``` :05 :<05 :>05 :^05 Python 3.6 |-0001| |-1000| |000-1| |0-100| Rust before |-0001| |-1000| |-0001| |-0100| Rust after |-0001| |-0001| |-0001| |-0001| :#05x :<#05x :>#05x :^#05x Python 3.6 |0x001| |0x100| |000x1| |00x10| Rust before |0x001| |0x100| |000x1| |0x010| Rust after |0x001| |0x001| |0x001| |0x001| ``` Fixes #39997 [breaking-change]
2017-03-18add inline attributes to stage 0 methodsTim Neumann-0/+4
2017-03-18translate drop glue using MIRAriel Ben-Yehuda-1/+36
Drop of arrays is now translated in trans::block in an ugly way that I should clean up in a later PR, and does not handle panics in the middle of an array drop, but this commit & PR are growing too big.
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-17Rollup merge of #40520 - steveklabnik:link-core-slice, r=alexcrichtonCorey Farwell-1/+3
Link core::slice to std::slice
2017-03-17Rollup merge of #40514 - stjepang:inline-then-ordering, r=alexcrichtonCorey Farwell-0/+2
Inline functions Ordering::{then, then_with} @jongiddy noticed bad performance due to the lack of inlining on `then` and `then_with`. I confirmed that inlining really is the culprit by creating a custom `then` function and repeating his benchmark on my machine with and without the `#[inline]` attribute. The numbers were exactly the same on my machine without the attribute. With `#[inline]` I got the same performance as I did with manually inlined implementation. The problem was reported in #37053.
2017-03-17Rollup merge of #40505 - frewsxcv:hash-docs, r=alexcrichtonCorey Farwell-13/+31
A few improvements to the `core::hash` top-level docs. Primarily opened to address the concerns brought up in https://github.com/rust-lang/rust/issues/40498. * run rustfmt on code blocks * use `DefaultHasher` instead of deprecated `SipHasher` * rename `hash` to `calculate_hash` to prevent confusion with the `hash` method
2017-03-17Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, ↵Corey Farwell-198/+198
r=GuillaumeGomez Remove function invokation parens from documentation links. This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-17Rollup merge of #40387 - tbu-:pr_doc_ptr_write2, r=steveklabnikCorey Farwell-3/+5
Reword the non-dropping of `src` for `ptr::write{,_unaligned}` @niconii Is it OK if I put your wording into the documentation? CC @nagisa
2017-03-15Rename TryFrom's associated type and implement str::parse using TryFrom.Jimmy Cuadra-13/+28
Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err". See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968. TryFrom<&str> and FromStr are equivalent, so have the latter provide the former to ensure that. Using TryFrom in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to suggest implementing `TryFrom<&str>` instead for new code. See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994 and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827. Refs #33417.
2017-03-15Change how the 0 flag works in format! for floatsPiotr Jawniak-1/+4
Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. :06 :<06 :>06 :^06 before |-001.2| |-1.200| |-001.2| |-01.20| after |-001.2| |-001.2| |-001.2| |-001.2|
2017-03-15Change how the `0` flag works in format!Piotr Jawniak-0/+1
Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. This also affects the '#' flag: zeroes are placed after the prefix (0b, 0o, 0x) and before the digits. :05 :<05 :>05 :^05 before |-0001| |-1000| |-0001| |-0100| after |-0001| |-0001| |-0001| |-0001| :#05x :<#05x :>#05x :^#05x before |0x001| |0x100| |000x1| |0x010| after |0x001| |0x001| |0x001| |0x001| Fixes #39997 [breaking-change]
2017-03-15use simd blocksDjzin-10/+20
2017-03-15make shift builtins panic-free with new unchecked_sh* intrinsicsTim Neumann-18/+104
Also update some 128 bit builtins to be panic-free without relying on the const evaluator.
2017-03-14Link core::slice to std::slicesteveklabnik-1/+3
2017-03-14Inline functions Ordering::{then, then_with}Stjepan Glavina-0/+2
@jongiddy noticed bad performance due to the lack of inlining on `then` and `then_with`. I confirmed that inlining really is the culprit by creating a custom `then` function and repeating his benchmark on my machine with and without the `#[inline]` attribute. The numbers were exactly the same on my machine without the attribute. With `#[inline]` I got the same performance as I did with manually inlined implementation.
2017-03-14Add tracking issue number for Utf8Error::error_lenSimon Sapin-1/+1
2017-03-14Replace Utf8Error::resume_from with Utf8Error::error_lenSimon Sapin-10/+12
Their relationship is: * `resume_from = error_len.map(|l| l + valid_up_to)` * error_len is always one of None, Some(1), Some(2), or Some(3). When I started using resume_from I almost always ended up subtracting valid_up_to to obtain error_len. Therefore the latter is what should be provided in the first place.
2017-03-14Add Utf8Error::resume_from, to help incremental and/or lossy decoding.Simon Sapin-22/+56
Without this, code outside of the standard library needs to reimplement most of the logic `from_utf8` to interpret the bytes after `valid_up_to()`.
2017-03-14A few improvements to the `core::hash` top-level docs.Corey Farwell-13/+31
Primarily opened to address the concerns brought up in https://github.com/rust-lang/rust/issues/40498. * run rustfmt on code blocks * use `DefaultHasher` instead of deprecated `SipHasher` * rename `hash` to `calculate_hash` to prevent confusion with the `hash` method
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-198/+198
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-13add SWAP_BLOCK_SIZE constantDjzin-7/+9
2017-03-13Fix a typo in Rev docsStjepan Glavina-1/+1
2017-03-12fix typoDjzin-1/+1
2017-03-12a new approach; ditch xor cuteness and maximize cache localityDjzin-6/+18
2017-03-12avoid recursionDjzin-2/+5
2017-03-12speed up mem::swapDjzin-12/+9
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-09Reword the non-dropping of `src` for `ptr::write{,_unaligned}`Tobias Bucher-3/+5
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