about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2017-08-11Merge remote-tracking branch 'origin/master' into genAlex Crichton-3/+33
2017-08-11Add (a lot of) missing links in fmt module docsGuillaume Gomez-32/+55
2017-08-11Rollup merge of #43793 - j-browne:master, r=steveklabnikGuillaume Gomez-1/+1
Fix broken links in Arc documentation Some link references had ticks, when they should not have had them.
2017-08-11Rollup merge of #43721 - natboehm:patch-1, r=steveklabnikGuillaume Gomez-2/+32
Provide more explanation for Deref in String docs While working on a different project I encountered a point of confusion where using `&String` to dereference a `String` into `&str` did not compile. I found the explanation of [String Deref](https://doc.rust-lang.org/std/string/struct.String.html#deref), thought that it matched what I was trying to do, and was confused as to why my program did not compile when the docs stated that it would work with 'any function which takes a `&str`'. At the bottom it is mentioned that this will 'generally' work, unless `String` is needed, but I found this statement confusing based on the previous claim of 'any'. Looking further into the docs I was able to find the function `as_str()` that works instead. I thought it might be helpful to mention here deref coercion, an instance in which using `&String` does not work, to explain why it does not work, then direct users to a different option that should work in this instance. A user casually skimming the page will likely come to this explanation first, then find `as_str()` later, but be no the wiser as to what potentially went wrong. r? @steveklabnik
2017-08-11Fix some typosBastien Orivel-3/+3
2017-08-10Fix broken links in Arc documentationJustin Browne-1/+1
2017-08-10Merge remote-tracking branch 'origin/master' into genAlex Crichton-6/+6
2017-08-10Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1bors-6/+6
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-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-11/+33
2017-08-08Fix trait name `Deref`Natalie Boehm-1/+1
2017-08-08Update solution to add using `&*` as well as `as_str()`Natalie Boehm-4/+9
2017-08-07Update explanation of deref coercionNatalie Boehm-8/+10
2017-08-05Indicate how to turn byte slices back into a string slice.Corey Farwell-2/+9
2017-08-05Update str::split_at_mut example to demonstrate mutability.Corey Farwell-6/+10
2017-08-04Update String Deref to explain why using &String does not always workNatalie Boehm-2/+25
2017-08-04Indicate why str::{get,get_mut} examples return None.Corey Farwell-5/+15
2017-08-01Fixed extra cases found in better checking.Isaac van Bakel-2/+2
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-4/+4
2017-07-29Rollup merge of #43513 - alexcrichton:inline-repeat, r=BurntSushiMark Simulacrum-0/+1
std: Mark `Layout::repeat` as `#[inline]` This fixes an optimization regression by allowing LLVM to see through more functions. Closes #43272
2017-07-29std: Mark `Layout::repeat` as `#[inline]`Alex Crichton-0/+1
This fixes an optimization regression by allowing LLVM to see through more functions. Closes #43272
2017-07-28Rename State to GeneratorStateJohn Kåre Alsaker-2/+2
2017-07-28Remove support for `gen arg`Alex Crichton-4/+4
2017-07-28Fill in generator tracking issue in a few more locationsAlex Crichton-1/+1
2017-07-28Fix testsAlex Crichton-1/+1
2017-07-28std: Add forwarding impls of `Generator` traitAlex Crichton-1/+13
2017-07-28Auto merge of #43217 - pnkfelix:alloc-requires-align-it-in-u32, r=alexcrichtonbors-7/+15
Add precondition to `Layout` that the `align` fit in a u32. Add precondition to `Layout` that the `align` not exceed 2^31. This precondition takes the form of a behavorial change in `Layout::from_size_align` (so it returns `None` if the input `align` is too large) and a new requirement for safe usage of `Layout::from_size_align_unchecked`. Fix #30170.
2017-07-26Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturonbors-17/+7
Stabilize more APIs for the 1.20.0 release In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
2017-07-26Rollup merge of #43455 - QuietMisdreavus:extend-spec-docs, r=steveklabnikMark Simulacrum-0/+6
add a note to Vec's Extend<&T> impl about its slice specialization From the regular documentation view, it's not at all apparent that [this specialization](https://github.com/rust-lang/rust/blob/5669c9988f50788b5ab5dee2d4538519d4e5663d/src/liballoc/vec.rs#L1879-L1891) exists for `slice::Iter`. This adds a documentation blurb to the Extend impl itself to note that this optimization exists.
2017-07-26Rollup merge of #42959 - SimonSapin:nonzero-checked, r=sfacklerMark Simulacrum-43/+68
Make the "main" constructors of NonZero/Shared/Unique return Option Per discussion in https://github.com/rust-lang/rust/issues/27730#issuecomment-303939441. This is a breaking change to unstable APIs. The old behavior is still available under the name `new_unchecked`. Note that only that one can be `const fn`, since `if` is currently not allowed in constant contexts. In the case of `NonZero` this requires adding a new `is_zero` method to the `Zeroable` trait. I mildly dislike this, but it’s not much worse than having a `Zeroable` trait in the first place. `Zeroable` and `NonZero` are both unstable, this can be reworked later.
2017-07-25add a note to Vec's Extend<&T> impl about its slice specializationQuietMisdreavus-0/+6
2017-07-25std: Stabilize the `str_{mut,box}_extras` featureAlex Crichton-4/+3
Stabilizes * `<&mut str>::as_bytes_mut` * `<Box<str>>::into_boxed_bytes` * `std::str::from_boxed_utf8_unchecked` * `std::str::from_utf8_mut` * `std::str::from_utf8_unchecked_mut` Closes #41119
2017-07-25std: Stabilize `manually_drop` featureAlex Crichton-1/+0
Stabilizes * `core::mem::ManuallyDrop` * `std::mem::ManuallyDrop` * `ManuallyDrop::new` * `ManuallyDrop::into_inner` * `ManuallyDrop::drop` * `Deref for ManuallyDrop` * `DerefMut for ManuallyDrop` Closes #40673
2017-07-25std: Stabilize `utf8_error_error_len` featureAlex Crichton-1/+0
Stabilizes: * `Utf8Error::error_len` Closes #40494
2017-07-25std: Stabilize `str_checked_slicing` featureAlex Crichton-10/+4
Stabilized * `<str>::get` * `<str>::get_mut` * `<str>::get_unchecked` * `<str>::get_unchecked_mut` Closes #39932
2017-07-25std: Stabilize `char_escape_debug`Alex Crichton-1/+0
Stabilizes: * `<char>::escape_debug` * `std::char::EscapeDebug` Closes #35068
2017-07-25Bump master to 1.21.0Alex Crichton-2/+1
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-24Rollup merge of #43374 - stjepang:fix-sort-randomization-comment, r=alexcrichtonMark Simulacrum-15/+18
Clarify that sort_unstable is deterministic @frankmcsherry complained that the documentation said "it is randomized but deterministic", which is a contradictory statement. This PR uses a different and clearer wording.
2017-07-22Use checked NonZero constructor instead of explicit null check in btreeSimon Sapin-6/+4
2017-07-22Add conversions from references to NonZero pointers, Unique, and SharedSimon Sapin-3/+3
2017-07-22Add Box::into_uniqueSimon Sapin-21/+48
2017-07-22Rename {NonZero,Shared,Unique}::new to new_uncheckedSimon Sapin-25/+25
2017-07-21Auto merge of #43318 - jhjourdan:jh/fix_weak_cound_MAX, r=alexcrichtonbors-1/+23
Fix in weak_count in Arc in the case the weak count is locked. In the case the weak count was locked, the weak_count function could return usize::MAX. We need to test this condition manually.
2017-07-21Clarify that sort_unstable is deterministicStjepan Glavina-15/+18
2017-07-20Auto merge of #43270 - petrochenkov:fixstab, r=alexcrichtonbors-2/+2
Fix checking for missing stability annotations This was a regression from https://github.com/rust-lang/rust/pull/37676 causing "unmarked API" ICEs like https://github.com/rust-lang/rust/issues/43027. r? @alexcrichton
2017-07-20Add test test_weak_count_lockedJacques-Henri Jourdan-0/+19
2017-07-19Add Vec::drain_filterAlexis Beingessner-0/+281
2017-07-18Fix in weak_count in Arc.Jacques-Henri Jourdan-1/+4
In the case the weak count was locked, the weak_count function could return usize::MAX. We need to test this condition manually.
2017-07-18Fix erroneous reference to Arc instead of RcLynn-1/+1
2017-07-16Fix checking for missing stability annotationsVadim Petrochenkov-2/+2
Remove couple of unnecessary `#![feature(staged_api)]`.
2017-07-13Add precondition to `Layout` that the `align` fit in a u32.Felix S. Klock II-7/+15
This precondition takes the form of a behavorial change in `Layout::from_size_align` (so it returns `None` if the `align` is too large) and a new requirement for safe usage of `Layout::from_size_align_unchecked`. Fix #30170.