about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2017-08-17Merge remote-tracking branch 'origin/master' into genAlex Crichton-7/+14
2017-08-17Rollup merge of #43928 - anthonyclays:anthonyclays-refcell-docfix, ↵Corey Farwell-1/+1
r=QuietMisdreavus Fixed typo in RefCell::get_mut "[...] is usually not you want." => "[...] is usually not what you want."
2017-08-17Rollup merge of #43905 - partim:master, r=steveklabnikCorey Farwell-1/+8
Document that `std::hash::Hasher::finish()` does not reset the hasher. Clarifies the fact that `finish()` doesn’t in fact end or reset the hasher. This was surprising to me … Follows up on and fixes #43763
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-5/+5
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-17Fixed typo in RefCell::get_mutAnthony Clays-1/+1
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-40/+42
2017-08-16Document that std::hash::Hasher::finish() does not reset the hasher.Martin Hoffmann-1/+8
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-40/+40
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-5/+5
2017-08-14Merge remote-tracking branch 'origin/master' into genAlex Crichton-543/+708
2017-08-14Rollup merge of #43868 - lukaramu:issue-43866, r=steveklabnikCorey Farwell-0/+2
Add missing newline in Deref docs to fix rendering Fixes #43866. (Verified locally.) r? @steveklabnik
2017-08-14Add missing newline in Deref docs to fix renderinglukaramu-0/+2
Fixes #43866.
2017-08-14Auto merge of #43574 - notriddle:master, r=sfacklerbors-0/+71
Implement `RefCell::replace` and `RefCell::swap` Tracking issue: #43570
2017-08-14Make `Clone` a lang item and generate builtin impls.scalexm-0/+8
Fixes #28229. Fixes #24000.
2017-08-14Auto merge of #43856 - sfackler:no-inline-debug, r=alexcrichtonbors-5/+0
Don't inline debug methods The inner methods aren't inlined, so this puts more pressure on LLVM for literally no benefit. Closes #43843
2017-08-13Don't inline debug methodsSteven Fackler-5/+0
The inner methods aren't inlined, so this puts more pressure on LLVM for literally no benefit. Closes #43843
2017-08-13Auto merge of #43836 - taleks:issue-39827, r=arielb1bors-3/+16
Fix for issue #39827 *Cause of the issue* While preparing for `trans_intrinsic_call()` invoke arguments are processed with `trans_argument()` method which excludes zero-sized types from argument list (to be more correct - all arguments for which `ArgKind` is `Ignore` are filtered out). As result `volatile_store()` intrinsic gets one argument instead of expected address and value. *How it is fixed* Modification of the `trans_argument()` method may cause side effects, therefore change was implemented in `volatile_store()` intrinsic building code itself. Now it checks function signature and if it was specialised with zero-sized type, then emits `C_nil()` instead of accessing non-existing second argument.
2017-08-13Addresses comments in PR #43836Alexey Tarasov-10/+8
- removes warnings introduced in changeset 0cd3587 - makes documentation more neat and grammatically correct
2017-08-13Rollup merge of #43814 - Eijebong:fix_typos2, r=petrochenkovGuillaume Gomez-1/+1
Fix some typos Follow up of #43794 If refined my script a little bit and found some more.
2017-08-12Auto merge of #43724 - lukaramu:std-ops-docs, r=QuietMisdreavusbors-529/+615
Improve std::ops docs Fixes #29365. (This fixes all but one point from @steveklabnik's list, but that point was referring to examples of implementing range traits, but there are no range traits in std::ops.) The main changes are quite a bit of copyediting, adding more "real" examples for some of the traits, incorporating some guidance from the API docs, more linking (cross-docs and to the book & reference), cleaning up examples, moving things around, and so on. Refer to the commit messages for more details. Note: I decided to link to the second edition of the book since I think it's more appropriate now for the sections I linked, if this is not okay, please say so!
2017-08-12std::ops docs: incorporated changes suggested in reviewlukaramu-58/+82
* fixed link typos and copy-paster errors * rewrote Fn* explanations * `RHS = Self` -> `RHS` is `Self` (added that to all applicable places as well) * fixed up some links * s/MutDeref/DerefMut * removed remaining superfluous `fn main()`s * fixed some minor phrasings and factual errors and inaccuracies std::ops docs: Fix phrasing and factual errors/inaccuracies
2017-08-12Fix some typosBastien Orivel-1/+1
2017-08-12Follow up commit for the issue 39827Alexey Tarasov-3/+18
- updates documentation on volatile memory intrinsics, now the case of zero-sized types is mentioned explicitly. Volatile memory operations which doesn't affect memory at all are omitted in LLVM backend, e.g. if number of elements is zero or type used in generic specialisation is zero-sized, then LLVM intrinsic or related code is not generated. This was not explicitly documented before in Rust documentation and potentially could cause issues.
2017-08-12Auto merge of #43794 - Eijebong:fix_typos, r=lukaramu,steveklanik,imperiobors-5/+5
Fix some typos I wrote a really naive script and found those typos in the documentation.
2017-08-12Merge branch 'master' of https://github.com/rust-lang/rust into genJohn Kåre Alsaker-3/+17
# Conflicts: # src/librustc_mir/build/scope.rs
2017-08-11Auto merge of #43750 - tbu-:pr_fn_unreachable, r=sfacklerbors-3/+17
Put `intrinsics::unreachable` on a possible path to stabilization Mark it with the `unreachable` feature and put it into the `mem` module. This is a pretty straight-forward API that can already be simulated in stable Rust by using `transmute` to create an uninhabited enum that can be matched.
2017-08-11Add `#[inline]` to `mem::unreachable`Tobias Bucher-0/+1
2017-08-11Fix some more typos, this time words that are duplicated.Bastien Orivel-1/+1
2017-08-11Fix some typosBastien Orivel-4/+4
2017-08-10Merge remote-tracking branch 'origin/master' into genAlex Crichton-14/+38
2017-08-10Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1bors-9/+9
Fixed mutable vars being marked used when they weren't #### NB : bootstrapping is slow on my machine, even with `keep-stage` - fixes for occurances in the current codebase are <s>in the pipeline</s> done. This PR is being put up for review of the fix of the issue. Fixes #43526, Fixes #30280, Fixes #25049 ### Issue Whenever the compiler detected a mutable deref being used mutably, it marked an associated value as being used mutably as well. In the case of derefencing local variables which were mutable references, this incorrectly marked the reference itself being used mutably, instead of its contents - with the consequence of making the following code emit no warnings ``` fn do_thing<T>(mut arg : &mut T) { ... // don't touch arg - just deref it to access the T } ``` ### Fix Make dereferences not be counted as a mutable use, but only when they're on borrows on local variables. #### Why not on things other than local variables? * Whenever you capture a variable in a closure, it gets turned into a hidden reference - when you use it in the closure, it gets dereferenced. If the closure uses the variable mutably, that is actually a mutable use of the thing being dereffed to, so it has to be counted. * If you deref a mutable `Box` to access the contents mutably, you are using the `Box` mutably - so it has to be counted.
2017-08-10Auto merge of #43735 - est31:master, r=alexcrichtonbors-2/+12
Avoid calling the column!() macro in panic Closes #43057 This "fix" adds a new macro called `__rust_unstable_column` and to use it instead of the `column` macro inside panic. The new macro can be shadowed as well as `column` can, but its very likely that there is no code that does this in practice. There is no real way to make "unstable" macros that are usable by stable macros, so we do the next best thing and prefix the macro with `__rust_unstable` to make sure people recognize it is unstable. r? @alexcrichton
2017-08-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-26/+41
2017-08-09Auto merge of #43728 - zackmdavis:fnused, r=eddybbors-0/+7
#[must_use] for functions This implements [RFC 1940](https://github.com/rust-lang/rfcs/pull/1940). The RFC and discussion thereof seem to suggest that tagging `PartialEq::eq` and friends as `#[must_use]` would automatically lint for unused comparisons, but it doesn't work out that way (at least the way I've implemented it): unused `.eq` method calls get linted, but not `==` expressions. (The lint operates on the HIR, which sees binary operations as their own thing, even if they ultimately just call `.eq` _&c._.) What do _you_ think?? Resolves #43302.
2017-08-09Auto merge of #43595 - oyvindln:master, r=aturonbors-3/+10
Add an overflow check in the Iter::next() impl for Range<_> to help with vectorization. This helps with vectorization in some cases, such as (0..u16::MAX).collect::<Vec<u16>>(), as LLVM is able to change the loop condition to use equality instead of less than and should help with #43124. (See also my [last comment](https://github.com/rust-lang/rust/issues/43124#issuecomment-319098625) there.) This PR makes collect on ranges of u16, i16, i8, and u8 **significantly** faster (at least on x86-64 and i686), and pretty close, though not quite equivalent to a [manual unsafe implementation](https://is.gd/nkoecB). 32 ( and 64-bit values on x86-64) bit values were already vectorized without this change, and they still are. This PR doesn't seem to help with 64-bit values on i686, as they still don't vectorize well compared to doing a manual loop. I'm a bit unsure if this was the best way of implementing this, I tried to do it with as little changes as possible and avoided changing the step trait and the behavior in RangeFrom (I'll leave that for others like #43127 to discuss wider changes to the trait). I tried simply changing the comparison to `self.start != self.end` though that made the compiler segfault when compiling stage0, so I went with this method instead for now. As for `next_back()`, reverse ranges seem to optimise properly already.
2017-08-09`mem::unreachable`: Add tracking issueTobias Bucher-1/+1
2017-08-09Put `intrinsics::unreachable` on a possible path to stabilizationTobias Bucher-3/+16
Mark it with the `unreachable` feature and put it into the `mem` module. This is a pretty straight-forward API that can already be simulated in stable Rust by using `transmute` to create an uninhabited enum that can be matched.
2017-08-08mark comparison trait methods as #[must_use]Zack M. Davis-0/+7
Note that this doesn't actually give us warnings on `a == b;` and the like, as some observers may have hoped. This is in the matter of #43302.
2017-08-08Clarify the language around `RefCell::swap`Michael Howell-1/+1
2017-08-08Assign tracking issue to option_ref_mut_clonedpanicbit-1/+1
2017-08-08Avoid calling the column!() macro in panicest31-2/+12
2017-08-08Added to core::ops module docslukaramu-5/+12
Part of #29365. * Added paragraph adapted from API guidelines that operator implementations should be unsurprising * Modified Point example to be more clear when just reading it
2017-08-08Revised core::ops::range::* docslukaramu-95/+120
Part of #29365. * Strenghtened summary/explanation split, making phrasings more parallel * Added links throughout * Fixed some example formatting & removed extraneous `fn main()`s (or hid then when needed because of `#![features]`. * Emphasized note on `RangeFrom`'s `Iterator` implementation * Added summary sentences to (unstable) `contains` methods
2017-08-07Revise `Fn`/`FnMut`/`FnOnce` documentationlukaramu-21/+74
Part of #29365. * Moved explanations out of Examples section and expanded on them. * Made the super-/subtrait relationships more explicit. * Added links to the other traits, TRPL and the nomicon where appropriate * Changed method summaries to be in 3rd person singular * General copyediting
2017-08-07Revise `Index` and `IndexMut` docs.lukaramu-26/+23
Part of #29365. * Shortened summary sentences, removing "stuttering" * Small copyediting * Changed method summary sentences to be in 3rd person singular * Removed extraneous explicit `fn main()` in example for `IndexMut`
2017-08-07Revise `Drop` docslukaramu-22/+40
Part of #29365. * Removed "stuttering" in summary sentence. * Copy-edited the explanaition sections * Added sub-headings in Examples section to aid linking * Actually implement `Drop` in the `PrintOnDrop` exampl * Add link to Drop chapter in TRPL * Changed `drop` summary sentence to be in 3rd person singular * Added missing link to `panic!`
2017-08-07Expand docs on `Deref` and `DerefMut`lukaramu-24/+78
Part of #29365. * Expanded the explanaition sections, adapting some parts from the book, the reference, as well as the API guidelines. As such, the docs now explicitly state that `Deref` and `DerefMut` should only be implemented for smart pointers and that they should not fail. Additionally, there is now a short primer on `Deref` coercion. * Added links to `DerefMut` from `Deref` and vice versa * Added links to relevant reference sections * Removed "stuttering" in summary sentences * Changed summary sentences of `Deref::deref` and `Deref::deref_mut` to be in 3rd person singular * Removed explicit uses of `fn main()` in the examples
2017-08-07Revise documentation in core::ops::bitlukaramu-150/+122
Part of #29365. * Added "real" examples for `BitOrAssign`, `BitXorAssign`, `ShlAssign`, and `ShrAssign` * Rewrote method summary senteces to be in 3rd person singular * Rephrased example introductions to be less redundant ("in this example" etc.) and to not use "trivial" * Removed superfluous explicit `fn main()`s in examples * Added some missing periods
2017-08-07Revise documentation in core::ops::arithlukaramu-182/+118
Part of #29365. * Replaced examples for Mul-/Div-/RemAssign with more illustrative ones * Made summary senteces for the trait methods use third person singular * Moved some explanations from Examples section to main explanation * Switched around argument order for the vector-scalar multiplication example such that the vector is on the left side (as it would be expected if one were to switch from `*` to `*=`) * Replaced mostly redundant example introductions with headings in traits with more than one example (where it made sense) * Cleaned up some examples to derive `PartialEq` instead of implementing it manually when that wasn't needed * Removed explicit `fn main()`s in examples where they weren't necessary * Rephrased some things * Added some missing periods * Fixed some formatting/punctuation in examples
2017-08-07Fix Option<&mut T>::cloned doc testpanicbit-0/+1