about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2017-03-23Rollup merge of #40715 - manuel-rhdt:patch-1, r=brsonCorey Farwell-3/+3
Fix doc error for ExactSizeIterator The code example in the trait documentation of ExactSizeIterator has an incorrect implementation of the len method that does not return the number of times the example iterator 'Counter' will iterate. This may confuse readers of the docs as the example code will compile but doesn't uphold the trait's contract. This is easily fixed by modifying the implementation of len and changing the assert statement to actually assert the correct behaviour. I also slightly modified a code comment to better reflect what the method returns.
2017-03-22Rollup merge of #40722 - stjepang:doc-consistency-fixes, r=steveklabnikCorey Farwell-30/+30
Various fixes to wording consistency in the docs A bunch of random fixes, added punctuation, plurals, backticks, and so on... r? @steveklabnik
2017-03-22Rollup merge of #40692 - SamWhited:consistent_str_docs_punctuation, r=bstrieCorey Farwell-1/+1
str: Make docs consistently punctuated Every so slightly pointless one character PR, but this was driving me nuts while reading the docs a moment ago (all the [other public structs](https://doc.rust-lang.org/std/str/index.html#structs) have descriptions that end in a full-stop).
2017-03-22Rollup merge of #40690 - GuillaumeGomez:fix-iter-docs, r=frewsxcvCorey Farwell-3/+3
Fix invalid linking in iter docs r? @rust-lang/docs
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-30/+30
2017-03-21Fix doc error for ExactSizeIteratorManuel-3/+3
The code example in the trait documentation of ExactSizeIterator has an incorrect implementation of the len method that does not return the number of times the example iterator 'Counter' will iterate. This may confuse readers of the docs as the example code will compile but doesn't uphold the trait's contract. This is easily fixed by modifying the implementation of len and changing the assert statement to actually assert the correct behaviour. I also slightly modified a code comment to better reflect what the method returns.
2017-03-21Fix invalid linking in iter docsGuillaume Gomez-3/+3
2017-03-21str: Make docs consistently punctuatedSam Whited-1/+1
2017-03-21Unit test heapsortStjepan Glavina-2/+11
2017-03-21Use partial insertion sortStjepan Glavina-54/+119
2017-03-21Tweak the constants a bitStjepan Glavina-5/+5
2017-03-21Fix grammarStjepan Glavina-3/+3
2017-03-21Faster sort_unstable on presorted inputsStjepan Glavina-13/+21
2017-03-21Address Alex's PR commentsStjepan Glavina-2/+0
2017-03-21Implement feature sort_unstableStjepan Glavina-22/+729
2017-03-20Rollup merge of #40671 - GuillaumeGomez:options-urls, r=frewsxcvCorey Farwell-4/+13
Add missing urls in Option enum r? @rust-lang/docs
2017-03-20Rollup merge of #40667 - DaseinPhaos:patch-4, r=GuillaumeGomezCorey Farwell-4/+4
Fix typo in `ptr` doc `sizeof` should be `size_of`
2017-03-20Rollup merge of #40332 - steveklabnik:extract-book, r=alexcrichtonCorey Farwell-10/+10
Extract book into a submodule Part of https://github.com/rust-lang/rust/issues/39588 We probably don't want to land this till after the beta branches on friday, but would still ❤️ a review from @alexcrichton , since I am a rustbuild noob. This pr: 1. removes the book 2. adds it back in as a submodule 3. the submodule includes both the old book and the new book 4. it also includes an index page explaining the difference in editions 5. it also includes redirect pages for the old book URLs. 6. so we build all that stuff too. r? @alexcrichton
2017-03-20Auto merge of #39628 - arielb1:shimmir, r=eddybbors-1/+36
Translate shims using MIR This removes one large remaining part of old trans.
2017-03-20Fix up various linkssteveklabnik-10/+10
The unstable book, libstd, libcore, and liballoc all needed some adjustment.
2017-03-20Add missing urls in Option enumGuillaume Gomez-4/+13
2017-03-20Fix typo in `ptr` docLuxko-4/+4
`sizeof` should be `size_of`
2017-03-20Auto merge of #40281 - jimmycuadra:try-from-from-str, r=aturonbors-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 #40521 - TimNN:panic-free-shift, r=alexcrichtonCorey Farwell-18/+108
Implemente overflowing_sh* with new unchecked_sh* intrinsics Also update some 128 bit builtins to not rely on the constant evaluator to avoid checked operations. Fixes #40508. cc @nagisa, @alexcrichton Note: I still have a build running to see if the 128 bit changes worked (unoptimized builds take *forever* to compile), however at least the overflowing builtins no longer reference `core::panicking::panic`.
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-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