about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-44210/+0
2020-07-26Auto merge of #74060 - kpp:remove_length_at_most_32, r=dtolnaybors-38/+17
Remove trait LengthAtMost32 This is a continuation of https://github.com/rust-lang/rust/pull/74026 preserving the original burrbull's commit. I talked to @burrbull, he suggested me to finish his PR.
2020-07-25Document UTF-8 validity of String::from_raw_partsaticu-0/+1
2020-07-25Fix wrong name in `String::from_raw_parts` docsaticu-2/+2
2020-07-25Auto merge of #74652 - poliorcetics:clarify-vec-drain-doc, r=jyn514bors-5/+4
Improve the documentation for Vec::drain Fixes #73844. @rusbot modify labels: A-collections, C-enhancement, T-doc, T-libs
2020-07-24Apply suggestion from reviewAlexis Bourget-6/+4
2020-07-24Rollup merge of #74677 - ssomers:btree_cleanup_2, r=AmanieuYuki Okushi-20/+47
Remove needless unsafety from BTreeMap::drain_filter Remove one piece of unsafe code in the iteration over the iterator returned by BTreeMap::drain_filter. - Changes an explicitly unspecified part of the API: when the user-supplied predicate (or some of BTreeMap's code) panicked, and the caller tries to use the iterator again, we no longer offer the same key/value pair to the predicate again but pretend the iterator has finished. Note that Miri does not find UB in the test case added here with the unsafe code (or without). - Makes the code a little easier on the eyes. - Makes the code a little harder on the CPU: ``` benchcmp c0 c2 --threshold 3 name c0 ns/iter c2 ns/iter diff ns/iter diff % speedup btree::set::clone_100_and_drain_all 2,794 2,900 106 3.79% x 0.96 btree::set::clone_100_and_drain_half 2,604 2,964 360 13.82% x 0.88 btree::set::clone_10k_and_drain_half 287,770 322,755 34,985 12.16% x 0.89 ``` r? @Amanieu
2020-07-24Rollup merge of #74666 - ssomers:btree_cleanup_1, r=Mark-SimulacrumYuki Okushi-0/+80
More BTreeMap test cases, some exposing undefined behaviour Gathered from other ongoing PRs and all either blessed or ignored by Miri r? @Mark-Simulacrum
2020-07-23Remove unecessary linkAlexis Bourget-2/+0
2020-07-23BTreeMap::drain_filter: replace needless unsafety and testStein Somers-20/+47
2020-07-23Prefer type@strLzu Tao-3/+3
2020-07-23Make str point to primitive pageLzu Tao-1/+2
2020-07-22More BTreeMap test cases, some exposing undefined behaviourStein Somers-0/+80
2020-07-22Improve the documentation for Vec::drainAlexis Bourget-4/+7
2020-07-20Auto merge of #74010 - pierwill:pierwill-o-notation, r=GuillaumeGomezbors-35/+35
Use italics for O notation In documentation, I think it makes sense to italicize O notation (*O(n)*) as opposed to using back-ticks (`O(n)`). Visually, back-ticks focus the reader on the literal characters being used, making them ideal for representing code. Using italics, as far I can tell, more closely follows typographic conventions in mathematics and computer science. Just a suggestion, of course! 😇
2020-07-19Use italics for O notationpierwill-35/+35
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2020-07-18Clarify the literal stringManish Goregaokar-1/+1
2020-07-18Use intra-doc links in BTreeMapManish Goregaokar-21/+12
2020-07-18Use more intra-doc links in BTreeSetManish Goregaokar-3/+3
2020-07-18Use intra-doc links in alloc::StringManish Goregaokar-100/+47
2020-07-17Rollup merge of #74453 - Manishearth:intra-doc-std, r=jyn514Manish Goregaokar-15/+7
Use intra-doc links in `str` and `BTreeSet` Fixes #32129, fixes #32130 A _slight_ degradation in quality is that the `#method.foo` links would previously link to the same page on `String`'s documentation, and now they will navigate to `str`. Not a big deal IMO, and we can also try to improve that.
2020-07-17Use intra-doc links in BTreeSet docsManish Goregaokar-15/+7
2020-07-17Fix Arc::as_ptr docsAbendstolz-1/+1
As a none-native speaker I stumbled upon this, looked it up and couldn't find a phrase, so I made my own assumption that "in any way" was meant (which is the meaning I would've deduced anyway)
2020-07-17Auto merge of #74395 - Mark-Simulacrum:stage0-next, r=pietroalbinibors-1/+0
Bump version to 1.47 This also bumps to a more recent rustfmt version, just to keep us relatively up to date (though almost nothing has changed in rustfmt we use beyond bumps to the parser infra). No formatting changes as a result of this. r? @pietroalbini
2020-07-16apply bootstrap cfgsMark Rousskov-1/+0
2020-07-16Separate off BTreeMap support functions and loose their irrelevant boundsStein Somers-59/+61
2020-07-16Clean up or comment every unwrap in BTreeMap's main code.Stein Somers-46/+40
2020-07-16Rollup merge of #74295 - ssomers:btree_comments, r=Mark-SimulacrumManish Goregaokar-18/+25
Add and fix BTreeMap comments No code changed (yet)
2020-07-14Remove unnecessary type hints from the Wake implYoshua Wuyts-3/+2
2020-07-13Add and fix BTreeMap commentsStein Somers-18/+25
2020-07-10Rollup merge of #74099 - jonhoo:deque-range, r=dtolnayManish Goregaokar-13/+163
Add VecDeque::range* methods This patch adds `VecDeque::range` and `VecDeque::range_mut` to provide iterators over a sub-range of a `VecDeque`. This behavior can be emulated with `skip` and `take`, but directly providing a `Range` is more ergonomic. This also partially makes up for `VecDeque`'s lack of `SliceIndex` support.
2020-07-10Add tracking issueJon Gjengset-2/+2
2020-07-09Rollup merge of #74143 - pickfire:patch-2, r=jonas-schievinkManish Goregaokar-2/+0
Try remove unneeded ToString import in liballoc slice
2020-07-08Remove unneeded ToString import in liballoc sliceIvan Tham-2/+0
2020-07-08Liballoc use vec instead of vectorIvan Tham-3/+3
Keep congruency with other parts, full word vector is rarely used.
2020-07-06Rollup merge of #73974 - CAD97:rc-no-weak, r=dtolnayManish Goregaokar-2/+2
Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr) These were stabilized alongside the Weak versions, but having `feature = "weak_.."` on a fn definition for the non-weak pointers is potentially very misleading, especially in a review context where the impl header may not be immediately visible. r? @RalfJung @bors rollup=always
2020-07-06fixupsJon Gjengset-4/+9
2020-07-06Add VecDeque::range* methodsJon Gjengset-13/+158
This patch adds `VecDeque::range` and `VecDeque::range_mut` to provide iterators over a sub-range of a `VecDeque`. This behavior can be emulated with `skip` and `take`, but directly providing a `Range` is more ergonomic. This also partially makes up for `VecDeque`'s lack of `SliceIndex` support.
2020-07-05Rollup merge of #74025 - tmiasko:try-unwrap, r=AmanieuManish Goregaokar-2/+1
Remove unnecessary release from Arc::try_unwrap The thread that recovers the unique access to Arc inner value (e.g., drop when ref-count strong reaches zero, successful try_unwrap), ensures that other operations on Arc inner value happened before by synchronizing with release operations performed when decrementing the reference counter. When try_unwrap succeeds, the current thread recovers the unique access to Arc inner value, so release is unnecessary. r? @Amanieu
2020-07-05Rollup merge of #72688 - djugei:master, r=AmanieuManish Goregaokar-0/+16
added .collect() into String from Box<str> I have not created an rfc, because i felt like this is a very minor change. i have just set a random feature name and rust version as stability attribute, i expect to have to change that, i just don't know what the policy on that is. all guides i could find focused on contributing to the compiler, not contributing to the standard library. drawbacks: more code in the standard library, could be replaced with specialization: base-implementation for AsRef\<str> and specialization for String and Cow. i can write that code if ppl want it. advantages: using "real strings" i.e. Box\<str> is as ergonomic as string slices (&str) and string buffers (String) with iterators.
2020-07-05Remove LengthAtMost32Roman Proskuryakov-1/+0
2020-07-05Remove the usage of the LengthAtMost32 traitRoman Proskuryakov-37/+17
2020-07-04Remove unnecessary release from Arc::try_unwrapTomasz MiÄ…sko-2/+1
The thread that recovers the unique access to Arc inner value (e.g., drop when ref-count strong reaches zero, successful try_unwrap), ensures that other operations on Arc inner value happened before by synchronizing with release operations performed when decrementing the reference counter. When try_unwrap succeeds, the current thread recovers the unique access to Arc inner value, so release is unnecessary.
2020-07-03Rollup merge of #73845 - CAD97:weak-as-unsized-ptr, r=RalfJungManish Goregaokar-44/+59
Use &raw in A|Rc::as_ptr This PR uses `&raw` for offsetting `*mut [A]RcInner<T> -> *mut T`. Additionally, this updates the implementation of `Weak::as_ptr` to support unsized `T`, though it does not yet relax the bounds of `Weak::as_ptr`/`into_raw`/`from_raw` to accept unsized `T`.
2020-07-03Auto merge of #73882 - nnethercote:avoid-unwrap_or_else-in-allocate_in, ↵bors-3/+14
r=Amanieu Avoid `unwrap_or_else` in `RawVec::allocate_in`. This reduces the amount of LLVM IR generated by up to 1 or 2%. r? @Amanieu
2020-07-02Note Weak.ptr never dangles soonerCAD97-0/+2
2020-07-02Move A|Rc::as_ptr from feature(weak_into_raw)CAD97-2/+2
to feature(rc_as_ptr) These were stabilized alongside the Weak versions, but having `feature = "weak_.."` on a fn definition for the non-weak pointers is potentially very confusing.
2020-07-02disable BTree min_max test in Miri for nowRalf Jung-0/+1
2020-07-01Reclarify safety comments in Weak::as_ptrCAD97-6/+6
2020-07-01Simplify Weak::as_ptr implCAD97-6/+4