about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2020-01-19Auto merge of #67758 - ssomers:testing_range, r=Mark-Simulacrumbors-31/+150
More thorough testing of BTreeMap::range Test more of the paths in the `range_search` function in map.rs
2020-01-17Allow added string.insert benchmarks to compileStein Somers-1/+1
2020-01-16Auto merge of #67339 - CAD97:rc-provenance, r=sfacklerbors-4/+24
Use pointer offset instead of deref for A/Rc::into_raw Internals thread: https://internals.rust-lang.org/t/rc-and-internal-mutability/11463/2?u=cad97 The current implementation of (`A`)`Rc::into_raw` uses the `Deref::deref` implementation to get the pointer-to-data that is returned. This is problematic in the proposed Stacked Borrow rules, as this only gets shared provenance over the data location. (Note that the strong/weak counts are `UnsafeCell` (`Cell`/`Atomic`) so shared provenance can still mutate them, but the data itself is not.) When promoted back to a real reference counted pointer, the restored pointer can be used for mutation through `::get_mut` (if it is the only surviving reference). However, this mutates through a pointer ultimately derived from a `&T` borrow, violating the Stacked Borrow rules. There are three known potential solutions to this issue: - Stacked Borrows is wrong, liballoc is correct. - Fully admit (`A`)`Rc` as an "internal mutability" type and store the data payload in an `UnsafeCell` like the strong/weak counts are. (Note: this is not needed generally since the `RcBox`/`ArcInner` is stored behind a shared `NonNull` which maintains shared write provenance as a raw pointer.) - Adjust `into_raw` to do direct manipulation of the pointer (like `from_raw`) so that it maintains write provenance and doesn't derive the pointer from a reference. This PR implements the third option, as recommended by @RalfJung. Potential future work: provide `as_raw` and `clone_raw` associated functions to allow the [`&T` -> (`A`)`Rc<T>` pattern](https://internals.rust-lang.org/t/rc-and-internal-mutability/11463/2?u=cad97) to be used soundly without creating (`A`)`Rc` from references.
2020-01-15Rollup merge of #68123 - crlf0710:linked_list_cursor, r=AmanieuDylan DPC-24/+707
Implement Cursor for linked lists. (RFC 2570). cc. #58533 cc. @Gankra r? @Amanieu
2020-01-14Update APIs according to RFC change suggestions.Charles Lew-18/+85
2020-01-12Address review comments.Charles Lew-2/+33
2020-01-12Address review comments.Charles Lew-83/+161
2020-01-12Implement Cursor for linked lists. (RFC 2570).Charles Lew-24/+531
2020-01-11Revert "Rollup merge of #67727 - Dylan-DPC:stabilise/remove_item, ↵Lzu Tao-1/+3
r=alexcrichton" This reverts commit 4ed415b5478c74094c2859abfddb959588cd6bb1, reversing changes made to 3cce950743e8aa74a4378dfdefbbc80223a00865.
2020-01-09Apply suggestions from code reviewStein Somers-1/+2
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-01-09Simplify into_key_slice_mut and document bits and bobsStein Somers-13/+20
2020-01-07Auto merge of #67312 - cuviper:clone-box-slice, r=SimonSapinbors-42/+1
Simplify Clone for Box<[T]> The bespoke `BoxBuilder` was basically a very simple `Vec`. Instead, let's clone to a real `Vec`, with all of its specialization for the task, then convert back to `Box<[T]>`.
2020-01-07Rollup merge of #67929 - mgrachev:patch-1, r=jonas-schievinkYuki Okushi-1/+1
Formatting an example for method Vec.retain
2020-01-06oh the one that was left behinddylan_DPC-1/+0
2020-01-06stabilise itdylan_DPC-1/+1
2020-01-06stabilise remove_itemdylan_DPC-1/+0
2020-01-06Formatting an example for method Vec.retainGrachev Mikhail-1/+1
2020-01-06Rollup merge of #67873 - Dylan-DPC:feature/change-remove-to-partial, r=AmanieuDylan DPC-1/+22
change remove to have a PartialEq bound Addresses [comment](https://github.com/rust-lang/rust/pull/67727#issuecomment-570660301). References #40062 r? @Amanieu
2020-01-05add feature gatedylan_DPC-0/+1
2020-01-05removed blank linedylan_DPC-1/+0
2020-01-04ef em ti ... :Pdylan_DPC-7/+6
2020-01-04Rollup merge of #67812 - ssomers:btreemap_internal_doc, r=rkruppeDylan DPC-15/+39
Tweak and extend internal BTreeMap documentation, including debug asserts. Gathered from work on various other pull requests (e.g. #67725, #67686).
2020-01-04add testsdylan_DPC-0/+15
2020-01-04add partial eq bound to remove_itemdylan_DPC-1/+8
2020-01-04Tweak and extend internal documentation, including debug asserts.Stein Somers-15/+39
Co-Authored-By: Robin Kruppe <robin.kruppe@gmail.com>
2020-01-02Use drop instead of the toilet closure `|_| ()`Lzu Tao-2/+2
2019-12-31More thorough testing of BTreeMap::rangeStein Somers-31/+150
2019-12-28Auto merge of #67459 - ssomers:#67438, r=RalfJungbors-25/+152
prune ill-conceived BTreeMap iter_mut assertion and test its mutability Proposal to deal with #67438 (and I'm more sure now that this is the right thing to do). Passes testing with miri.
2019-12-28Rollup merge of #67629 - kraai:remove-redundant-link-texts, r=steveklabnikOliver Scherer-8/+8
Remove redundant link texts Most of these links are followed by a parenthesized expression. I think that the redundant link texts were added to prevent interpretation as an inline link. This is unnecessary since the closing square bracket and opening parenthesis are separated by whitespace.
2019-12-26prune ill-conceived BTreeMap iter_mut assertion and test moreStein Somers-25/+152
2019-12-26Remove redundant link textsMatthew Kraai-8/+8
2019-12-24reuse `capacity` variable in slice::repeatking6cong-4/+4
2019-12-23Simplify Clone for Box<[T]>Josh Stone-42/+1
The bespoke `BoxBuilder` was basically a very simple `Vec`. Instead, let's clone to a real `Vec`, with all of its specialization for the task, then convert back to `Box<[T]>`.
2019-12-22Format the worldMark Rousskov-2061/+1698
2019-12-22Rollup merge of #67504 - Mark-Simulacrum:note-data-offset, r=CentrilMazdak Farrokhzad-0/+4
Warn against relying on ?Sized being last Fixes #62522
2019-12-21Warn against relying on ?Sized being lastMark Rousskov-0/+4
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-16/+16
2019-12-20Rollup merge of #66755 - mark-i-m:const-vec-new, r=ecstatic-morseMazdak Farrokhzad-18/+4
Remove a const-if-hack in RawVec r? @ecstatic-morse cc @Centril
2019-12-19Rollup merge of #67281 - llogiq:nonoverlapping-insert, r=alexcrichtonMark Rousskov-0/+40
add string.insert benchmarks This adds benchmarks for `String::insert` and `String::insert_str`
2019-12-18no need to bootstrapMark Mansi-9/+2
2019-12-18add fixmeMark Mansi-0/+1
2019-12-18fix importMark Mansi-1/+1
2019-12-18use usize::MAX instead of !0Mark Mansi-1/+1
2019-12-18remove a bit more hackeryMark Mansi-41/+9
2019-12-18Remove a const-if-hack in RawVecMark Mansi-8/+32
2019-12-18Propagate cfg bootstrapMark Rousskov-14/+3
2019-12-18Add benchmarks for string::insert(_str)Andre Bogus-0/+40
2019-12-17Add internal safety docs to (A)Rc::into_rawCAD97-0/+10
2019-12-16Rollup merge of #65778 - bdonlan:stable_weak_count, r=dtolnayMazdak Farrokhzad-49/+35
Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}` * Original PR: #56696 * Tracking issue: #57977 Closes: #57977 Supporting comments: > Although these were added for testing, it is occasionally useful to have a way to probe optimistically for whether a weak pointer has become dangling, without actually taking the overhead of manipulating atomics. Are there any plans to stabilize this? _Originally posted by @bdonlan in https://github.com/rust-lang/rust/issues/57977#issuecomment-516970921_ > Having this stabilized would help. Currently, the only way to check if a weak pointer has become dangling is to call `upgrade`, which is by far expensive. _Originally posted by @glebpom in https://github.com/rust-lang/rust/issues/57977#issuecomment-526934709_ Not sure if stabilizing these warrants a full RFC, so throwing this out here as a start for now. Note: per CONTRIBUTING.md, I ran the tidy checks, but they seem to be failing on unchanged files (primarily in `src/stdsimd`).
2019-12-15Use pointer offset instead of deref for A/Rc::into_rawcad97-4/+14