about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2018-12-11Test capacity of ZST vectorKonrad Borowski-0/+5
Initially, #50233 accidentally changed the capacity of empty ZST. This was pointed out during code review. This commit adds a test to prevent capacity of ZST vectors from accidentally changing to prevent that from happening again.
2018-12-11TypoAlexis Beingessner-1/+1
Co-Authored-By: RalfJung <post@ralfj.de>
2018-12-10Rollup merge of #56656 - BeatButton:liballoc_string_typo, r=CentrilGuillaume Gomez-1/+1
Fix typo
2018-12-10Document time of back operations of a Linked ListChris Couzens-1/+5
Popping and pushing from the end of a linked list is constant time. This documentation is already there for popping and pushing from the front. @bors: r+ 38fe8d2 rollup
2018-12-09Auto merge of #56463 - ljedrz:slice_concat_join, r=nikicbors-3/+3
slice: tweak concat & join - use `sum` instead of `fold` (readability) - adjust the capacity for `join` - the number of separators is `n - 1`, not `n`; proof: ``` fn main() { let a = [[1, 2], [4, 5]]; let v = a.join(&3); assert_ne!(v.len(), v.capacity()); // len is 5, capacity is 6 } ```
2018-12-09Fix typoBeatButton-1/+1
2018-12-09avoid as_leaf_mut asserting exclusive accessRalf Jung-30/+33
2018-12-09fix BTree creating shared references that are not entirely in-boundsRalf Jung-29/+86
2018-12-08Add Arc/Rc Eq testsThomas Heck-0/+84
2018-12-08Use private trait for Rc/Arc Eq specializationThomas Heck-37/+74
2018-12-08Short-circuit Rc/Arc equality checking on equal pointers where T: EqJo Liss-5/+46
Closes #42655
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-22/+22
2018-12-07Fix broken doc testCorey Farwell-1/+1
2018-12-07Drain only needs a shared referenceRalf Jung-7/+5
2018-12-07VecDeque::drain: make sure the 'drain' raw pointer is actually still usableRalf Jung-2/+7
2018-12-07Rollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrumkennytm-18/+18
Replace usages of `..i + 1` ranges with `..=i`. Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
2018-12-06Rollup merge of #56548 - Lucretiel:string-extend-optimize, r=sfacklerPietro Albini-18/+29
Optimized string FromIterator + Extend impls I noticed that there was a lost opportunity to reuse string buffers in `FromIterator<String>` and `FromIterator<Cow<str>>`; updated the implementations to use these. In practice this translates to at least one fewer allocation when using these APIs. Additionally, rewrote `Extend` implementations to use `iter.for_each`, which (supposedly) helps the compiler optimize those loops (because iterator adapters are encouraged to provide optimized implementations of `fold` and `try_fold`.
2018-12-06Rollup merge of #56500 - ljedrz:cleanup_rest_of_const_lifetimes, r=zackmdavisPietro Albini-1/+1
cleanup: remove static lifetimes from consts A follow-up to https://github.com/rust-lang/rust/pull/56497.
2018-12-05Added explainatory commentsNathan West-0/+6
2018-12-05Fixed mutabilityNathan West-4/+4
2018-12-05Rollup merge of #55987 - Thomasdezeeuw:weak-ptr_eq, r=sfacklerPietro Albini-1/+95
Add Weak.ptr_eq I hope the doc tests alone are good enough. We also might want to discuss the dangling pointer case (from `Weak::new()`). Updates #55981.
2018-12-05Optimized string FromIterator implsNathan West-18/+23
2018-12-05Fix typo in variable nameCorey Farwell-1/+1
2018-12-05Fix error in example by adding type annotationdaniellimws-1/+1
2018-12-04Replace usages of `..i + 1` ranges with `..=i`.Corey Farwell-18/+18
2018-12-04Add example of using the indexing operator to BTreeMap docsCorey Farwell-0/+3
2018-12-04cleanup: remove static lifetimes from constsljedrz-1/+1
2018-12-03slice: tweak concat & joinljedrz-3/+3
2018-12-03Rollup merge of #56432 - ordovicia:shrink-to-issue, r=Centrilkennytm-4/+4
Update issue number of `shrink_to` methods to point the tracking issue Tracking issue: #56431
2018-12-03Rollup merge of #56401 - scottmcm:vecdeque-resize-with, r=dtolnaykennytm-33/+27
Move VecDeque::resize_with out of the impl<T:Clone> block I put this in the wrong `impl` block in https://github.com/rust-lang/rust/pull/56016, so fixing. Tracking issue for the unstable method: https://github.com/rust-lang/rust/issues/41758#issuecomment-443077953
2018-12-03Fix link in Weak::newThomas de Zeeuw-1/+2
2018-12-03Add sync::Weak::ptr_eqThomas de Zeeuw-0/+47
2018-12-03Add rc::Weak.ptr_eqThomas de Zeeuw-0/+46
2018-12-02Auto merge of #56275 - RalfJung:win-mutex, r=SimonSapinbors-2/+2
use MaybeUninit instead of mem::uninitialized for Windows Mutex I hope this builds, I do not have a Windows machine to test...
2018-12-02avoid MaybeUninit::get_mut where it is not neededRalf Jung-2/+2
2018-12-02Update issue number of `shrink_to` methods to point the tracking issueHidehito Yabuuchi-4/+4
2018-12-01Redo the docs for Vec::set_lenScott McMurray-27/+53
Inspired by the recent conversation on IRLO.
2018-11-30Move VecDeque::resize_with out of the impl<T:Clone> blockScott McMurray-33/+27
2018-12-01Rollup merge of #56131 - ljedrz:assorted, r=RalfJungkennytm-0/+2
Assorted tweaks - preallocate `VecDeque` in `Decodable::decode` (as it is done with other collections which can do it) - add a FIXME to `String::from_utf16` r? @RalfJung
2018-11-23Merge branch 'master' into frewsxcv-dynCorey Farwell-6/+20
2018-11-22Auto merge of #53918 - Havvy:doc-sort-by, r=GuillaumeGomezbors-0/+16
Doc total order requirement of sort(_unstable)_by I took the definition of what a total order is from the Ord trait docs. I specifically put "elements of the slice" because if you have a slice of f64s, but know none are NaN, then sorting by partial ord is total in this case. I'm not sure if I should give such an example in the docs or not. r? @GuillaumeGomez
2018-11-21update various stdlib docsSteve Klabnik-6/+4
2018-11-21String: add a FIXME to from_utf16ljedrz-0/+2
2018-11-20Incorporate `dyn` into more comments and docs.Corey Farwell-10/+10
2018-11-17Add VecDeque::resize_withScott McMurray-1/+39
2018-11-17Add double quotes to resolve errordaniellimws-1/+1
2018-11-15Rollup merge of #55901 - euclio:speling, r=petrochenkovPietro Albini-2/+2
fix various typos in doc comments
2018-11-15Rollup merge of #55530 - ljedrz:speed_up_String_from_utf16, r=SimonSapinPietro Albini-1/+9
Speed up String::from_utf16 Collecting into a `Result` is idiomatic, but not necessarily fast due to rustc not being able to preallocate for the resulting collection. This is fine in case of an error, but IMO we should optimize for the common case, i.e. a successful conversion. This changes the behavior of `String::from_utf16` from collecting into a `Result` to pushing to a preallocated `String` in a loop. According to [my simple benchmark](https://gist.github.com/ljedrz/953a3fb74058806519bd4d640d6f65ae) this change makes `String::from_utf16` around **twice** as fast.
2018-11-13fix various typos in doc commentsAndy Russell-2/+2
2018-11-13Rollup merge of #55889 - RalfJung:global-alloc, r=alexcrichtonkennytm-0/+4
global allocators: add a few comments These comments answer some questions that came up when I tried to understand how the control flow works for the global allocator, `Global` and `System`. r? @alexcrichton