about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2018-03-01Specialize Zip::nth for TrustedRandomAccessScott McMurray-0/+84
Makes the bench asked about on URLO 58x faster :)
2018-02-28impl Default + Hash for ::core::cmp::ReverseM Farkas-Dyck-1/+1
2018-02-28Rollup merge of #48603 - pthariensflame:patch-1, r=frewsxcvManish Goregaokar-2/+2
Fixes #47311. r? @nrc
2018-02-28Rollup merge of #48380 - nikomatsakis:issue-48251-master, r=acrichtoManish Goregaokar-1/+2
Fixes #47311. r? @nrc
2018-02-28doc: no need for the referencesTshepang Lekhonkhobe-31/+22
Also: - apply some rustfmt love - fix output of one example
2018-02-28Add bitreverse intrinsicAmanieu d'Antras-0/+4
2018-02-28Rollup merge of #48450 - frewsxcv:frewsxcxv-stabilize-slice-rotatee, ↵kennytm-3/+2
r=alexcrichton Stabilize [T]::rotate_{left,right} https://github.com/rust-lang/rust/issues/41891
2018-02-28Rollup merge of #48365 - Centril:docs/document-refcell-panics, r=frewsxcvkennytm-0/+24
RefCell: document panics in Clone, PartialEq, PartialOrd, Ord. This fixes #47400 by adding: ```rust /// # Panics /// /// Panics if the value is currently mutably borrowed. ``` to said impls. They may panic since they call `.borrow()`.
2018-02-28Rollup merge of #48321 - milesand:no_panic_pow, r=alexcrichtonkennytm-0/+308
Add non-panicking variants of pow for integer types Currently, calling pow may panic in case of overflow, and the function does not have non-panicking counterparts. Thus, it would be beneficial to add those in. Closes #48291. Relevant tracking issue: #48320
2018-02-28Auto merge of #48056 - ExpHP:macro-commas, r=dtolnaybors-7/+35
Comprehensively support trailing commas in std/core macros I carefully organized the changes into four commits: * Test cases * Fixes for `macro_rules!` macros * Fixes for builtin macros * Docs for builtins **I can easily scale this back to just the first two commits for now if such is desired.** ### Breaking (?) changes * This fixes #48042, which is a breaking change that I hope people can agree is just a bugfix for an extremely dark corner case. * To fix five of the builtins, this changes `syntax::ext::base::get_single_str_from_tts` to accept a trailing comma, and revises the documentation so that this aspect is not surprising. **I made this change under the (hopefully correct) understanding that `libsyntax` is private rustc implementation detail.** After reviewing all call sites (which were, you guessed it, *precisely those five macros*), I believe the revised semantics are closer to the intended spirit of the function. ### Changes which may require concensus Up until now, it could be argued that some or all the following macros did not conceptually take a comma-separated list, because they only took one argument: * **`cfg(unix,)`** (most notable since cfg! is unique in taking a meta tag) * **`include{,_bytes,_str}("file.rs",)`** (in item form this might be written as "`include!{"file.rs",}`" which is even slightly more odd) * **`compile_error("message",);`** * **`option_env!("PATH",)`** * **`try!(Ok(()),)`** So I think these particular changes may require some sort of consensus. **All of the fixes for builtins are included this list, so if we want to defer these decisions to later then I can scale this PR back to just the first two commits.** ### Other notes/general requests for comment * Do we have a big checklist somewhere of "things to do when adding macros?" My hope is for `run-pass/macro-comma-support.rs` to remain comprehensive. * Originally I wanted the tests to also comprehensively forbid double trailing commas. However, this didn't work out too well: [see this gist and the giant FIXME in it](https://gist.github.com/ExpHP/6fc40e82f3d73267c4e590a9a94966f1#file-compile-fail_macro-comma-support-rs-L33-L50) * I did not touch `select!`. It appears to me to be a complete mess, and its trailing comma mishaps are only the tip of the iceberg. * There are [some compile-fail test cases](https://github.com/ExpHP/rust/blob/5fa97c35da2f0ee/src/test/compile-fail/macro-comma-behavior.rs#L49-L52) that didn't seem to work (rustc emits errors, but compile-fail doesn't acknowledge them), so they are disabled. Any clues? (Possibly related: These happen to be precisely the set of errors which are tagged by rustc as "this error originates in a macro outside of the current crate".) --- Fixes #48042 Closes #46241
2018-02-28Minor grammatical/style fix in docs.Alexander Ronald Altman-2/+2
2018-02-27and some more tidy checksMaxim Nazarenko-2/+2
2018-02-27fix tidy checksMaxim Nazarenko-3/+3
2018-02-27SimplifyMaxim Nazarenko-5/+9
Merge three rules into one following @cramertj
2018-02-27style fixMaxim Nazarenko-1/+1
2018-02-27Further refinement of Borrow documentation.Martin Hoffmann-32/+36
2018-02-27fix wording on panics in binary operators on RefCells"Mazdak Farrokhzad-7/+7
2018-02-27remove italicMaxim Nazarenko-2/+2
remove italic as per @GuillaumeGomez suggestion
2018-02-27Backport LLVM fixes for a JumpThreading / assume intrinsic bugBjörn Steinbrink-15/+9
2018-02-26Fix doctest failurePhlosioneer-1/+0
Tried to be fancy with print statements.
2018-02-26atomic: remove 'Atomic*' from Debug outputSean McArthur-5/+3
2018-02-26some grammar correctionsChristian Poveda-6/+7
2018-02-25Change the example string to something arbitraryPhlosioneer-4/+5
The choice of string is arbitrary, so all references to a number in the string were removed. The string is now the standard "Hello world!".
2018-02-25fixed linksChristian Poveda-2/+2
2018-02-25Rollup merge of #48235 - varkor:parse-float-lonely-exponent, r=alexcrichtonkennytm-1/+8
Make ".e0" not parse as 0.0 This forces floats to have either a digit before the separating point, or after. Thus `".e0"` is invalid like `"."`, when using `parse()`. Fixes #40654. As mentioned in the issue, this is technically a breaking change... but clearly incorrect behaviour at present.
2018-02-25Rollup merge of #48529 - remexre:docs/fix/unicode-0021, r=kennytmkennytm-1/+1
Fixes docs for ASCII functions to no longer claim U+0021 is '@'. Looks like a typo that got copy-pasted without anyone checking on it.
2018-02-25Rollup merge of #48115 - Centril:feature/iterator_flatten, r=alexcrichtonkennytm-36/+367
Add Iterator::flatten This adds the trait method `.flatten()` on `Iterator` which flattens one level of nesting from an iterator or (into)iterators. The method `.flat_fmap(f)` is then redefined as `.map(f).flatten()`. The implementation of `Flatten` is essentially that of what it was for `FlatMap` but removing the call to `f` at various places. Hopefully the type alias approach should be OK as was indicated / alluded to by @bluss and @eddyb in https://github.com/rust-lang/rfcs/pull/2306#issuecomment-361391370. cc @scottmcm
2018-02-24Fixes docs for ASCII functions to no longer claim U+0021 is '@'.Nathan Ringo-1/+1
2018-02-24corrected grammar errorsChristian Poveda-4/+4
2018-02-24added link to sync containersChristian Poveda-1/+2
2018-02-24Slight modification to the as_ref example of std::option::OptionPhlosioneer-2/+2
A user in a reddit thread was confused by the name of the variable "num_as_int"; they thought the example was trying to convert the string "10" as if it were binary 2 by calling str::len(). In reality, the example is simply demonstrating how to take an immutable reference to the value of an Option. The confusion comes from the coincidence that the length of the string "10" is also its binary representation, and the implication from the variable names that a conversion was occuring ("num_as_str" to "num_as_int"). This PR changes the example number to 12 instead of 10, and changes the variable name from "num_as_int" to "num_length" to better communicate what the example is doing. The reddit thread: https://www.reddit.com/r/rust/comments/7zpvev/notyetawesome_rust_what_use_cases_would_you_like/dur39xw/
2018-02-23cleaned trailing whitespacesChristian Poveda-2/+2
2018-02-23Rollup merge of #48157 - scottmcm:try-for-each, r=dtolnayManish Goregaokar-6/+42
Add Iterator::try_for_each The fallible version of `for_each` aka the stateless version of `try_fold`. Inspired by @cuviper's comment in https://github.com/rust-lang/rust/pull/45379#issuecomment-338370020 as a more direct and obvious solution than `.map(f).collect::<Result<(), _>>()`. Like `for_each`, no need for an `r` version thanks to overrides in `Rev`. `iterator_try_fold` tracking issue: https://github.com/rust-lang/rust/issues/45594
2018-02-23remove redundant infoChristian Poveda-5/+5
2018-02-23add info about syncChristian Poveda-1/+3
2018-02-22Stabilize [T]::rotate_{left,right}Corey Farwell-3/+2
https://github.com/rust-lang/rust/issues/41891
2018-02-22Auto merge of #48343 - Mark-Simulacrum:release-step, r=kennytmbors-26/+0
Update nightly to 1.26.0 and bootstrap from beta.
2018-02-22First versionChristian Poveda-1/+15
2018-02-21Rollup merge of #48397 - ordovicia:pow_doc, r=GuillaumeGomezGuillaume Gomez-2/+2
Take 2^5 as examples in document of pow() Fixes #48396 by taking 2^5 as examples.
2018-02-21Rollup merge of #48360 - redcape:redcape-count-doc-fix, r=cramertjGuillaume Gomez-1/+1
Fix count usize link typo in docs The docs point to isize when the link should be going to usize instead. Fix the doc.
2018-02-21Rollup merge of #47379 - da-x:master, r=sfacklerGuillaume Gomez-1/+1
Derive std::cmp::Reverse as Copy or Clone If the type parameter is Copy or Clone, then `Reverse` should be too.
2018-02-21Take 2^5 as examples in document of pow() (fixes #48396)Hidehito Yabuuchi-2/+2
Current document takes 2^4, which is equal to 4^2. This example is not very helpful for those unfamiliar with math words in English and thus rely on example codes.
2018-02-20make `#[unwind]` attribute specify expectations more clearlyNiko Matsakis-1/+2
You can now choose between the following: - `#[unwind(allowed)]` - `#[unwind(aborts)]` Per rust-lang/rust#48251, the default is `#[unwind(allowed)]`, though I think we should change this eventually.
2018-02-20stage0 cfg cleanupMark Simulacrum-26/+0
2018-02-20core::iter::Iterator::flatten: improve docs wrt. deep vs. shallow flatten ↵Mazdak Farrokhzad-0/+20
per @clarcharr's review
2018-02-20core::iter::Iterator::flatten: tracking issue is #48213Mazdak Farrokhzad-6/+6
2018-02-20core::iter::Flatten: update FlatMap & Flatten according to discussionMazdak Farrokhzad-20/+294
2018-02-20Iterator::flatten: fix tracking issue number on FusedIterator for FlattenMazdak Farrokhzad-1/+1
2018-02-20add Iterator::flatten and redefine flat_map(f) in terms of map(f).flatten()Mazdak Farrokhzad-47/+84
2018-02-20RefCell: document panics in Clone, PartialEq, PartialOrd, Ord. Fixes #47400Mazdak Farrokhzad-0/+24