Commit Graph

2121 Commits

Author SHA1 Message Date
bors 8c73fa70f3 Auto merge of #68154 - ssomers:btreemap_navigation_benches, r=Mark-Simulacrum
Add more BTreeMap/BTreeSet benchmarks regarding iteration

Serving #67073 or other developments
2020-01-21 03:07:01 +00:00
bors 6250d56355 Auto merge of #67758 - ssomers:testing_range, r=Mark-Simulacrum
More thorough testing of BTreeMap::range

Test more of the paths in the `range_search` function in map.rs
2020-01-19 04:40:21 +00:00
Stein Somers 4dbae1e8ba Allow added string.insert benchmarks to compile 2020-01-17 01:05:49 +01:00
bors e02c475da5 Auto merge of #67339 - CAD97:rc-provenance, r=sfackler
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-16 00:47:45 +00:00
Dylan DPC 1b7b8cbed3 Rollup merge of #68123 - crlf0710:linked_list_cursor, r=Amanieu
Implement Cursor for linked lists. (RFC 2570).

cc. #58533 cc. @Gankra

r? @Amanieu
2020-01-15 22:49:24 +05:30
Charles Lew 06b9a73cfa Update APIs according to RFC change suggestions. 2020-01-14 20:11:52 +08:00
Stein Somers 3ada8aeed4 Add more BTreeMap/BTreeSet benchmarks regarding iteration 2020-01-12 15:05:09 +01:00
Charles Lew d2c509a3c6 Address review comments. 2020-01-12 18:34:35 +08:00
Charles Lew 091ba6daa0 Address review comments. 2020-01-12 13:15:00 +08:00
Charles Lew d59e9b40a3 Implement Cursor for linked lists. (RFC 2570). 2020-01-12 01:51:04 +08:00
Lzu Tao 7ba25acd7a Revert "Rollup merge of #67727 - Dylan-DPC:stabilise/remove_item, r=alexcrichton"
This reverts commit 4ed415b547, reversing
changes made to 3cce950743.
2020-01-11 03:04:39 +00:00
Stein Somers 9b92bf8315 Apply suggestions from code review
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-01-09 12:03:49 +01:00
Stein Somers 37b5cca3d5 Simplify into_key_slice_mut and document bits and bobs 2020-01-09 11:45:32 +01:00
bors 8597644255 Auto merge of #67312 - cuviper:clone-box-slice, r=SimonSapin
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-07 18:10:56 +00:00
Yuki Okushi 2c25ad5d28 Rollup merge of #67929 - mgrachev:patch-1, r=jonas-schievink
Formatting an example for method Vec.retain
2020-01-07 13:46:10 +09:00
dylan_DPC 503d06b90d oh the one that was left behind 2020-01-06 23:28:47 +05:30
dylan_DPC 6bec8e9972 stabilise it 2020-01-06 20:37:49 +05:30
dylan_DPC 24c6cd80c3 stabilise remove_item 2020-01-06 19:36:46 +05:30
Grachev Mikhail e6d95ce0b8 Formatting an example for method Vec.retain 2020-01-06 15:18:03 +03:00
Dylan DPC 005d9d5b6e Rollup merge of #67873 - Dylan-DPC:feature/change-remove-to-partial, r=Amanieu
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-06 12:00:17 +05:30
dylan_DPC e03d1c4204 add feature gate 2020-01-05 15:42:35 +05:30
dylan_DPC 358b8983f2 removed blank line 2020-01-05 00:00:40 +05:30
dylan_DPC f744ea03b4 ef em ti ... :P 2020-01-04 23:57:34 +05:30
Dylan DPC 0bbe11089c Rollup merge of #67812 - ssomers:btreemap_internal_doc, r=rkruppe
Tweak and extend internal BTreeMap documentation, including debug asserts.

Gathered from work on various other pull requests (e.g. #67725, #67686).
2020-01-04 23:52:51 +05:30
dylan_DPC eb36688a01 add tests 2020-01-04 23:41:17 +05:30
dylan_DPC c09dac1073 add partial eq bound to remove_item 2020-01-04 23:31:32 +05:30
Stein Somers 92acdc8b89 Tweak and extend internal documentation, including debug asserts.
Co-Authored-By: Robin Kruppe <robin.kruppe@gmail.com>
2020-01-04 14:07:26 +01:00
Lzu Tao dd8f072233 Use drop instead of the toilet closure |_| () 2020-01-02 08:56:12 +00:00
Stein Somers 8314b7fd27 More thorough testing of BTreeMap::range 2019-12-31 18:21:57 +01:00
bors e39ae6f883 Auto merge of #67459 - ssomers:#67438, r=RalfJung
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-28 16:04:40 +00:00
Oliver Scherer b371e0fa00 Rollup merge of #67629 - kraai:remove-redundant-link-texts, r=steveklabnik
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-28 00:36:09 +01:00
Stein Somers e3c814e623 prune ill-conceived BTreeMap iter_mut assertion and test more 2019-12-26 18:26:57 +01:00
Matthew Kraai 21e636f188 Remove redundant link texts 2019-12-26 05:04:46 -08:00
king6cong 3c56a65bc4 reuse capacity variable in slice::repeat 2019-12-24 12:44:05 +08:00
Josh Stone 81a6709cf9 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]>`.
2019-12-23 07:35:39 -07:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Mazdak Farrokhzad ca528fcc04 Rollup merge of #67504 - Mark-Simulacrum:note-data-offset, r=Centril
Warn against relying on ?Sized being last

Fixes #62522
2019-12-22 02:40:07 +01:00
Mark Rousskov a34c2677af Warn against relying on ?Sized being last 2019-12-21 20:35:41 -05:00
Ross MacArthur f7256d28d1 Require issue = "none" over issue = "0" in unstable attributes 2019-12-21 13:16:18 +02:00
Mazdak Farrokhzad 57da9d3269 Rollup merge of #66755 - mark-i-m:const-vec-new, r=ecstatic-morse
Remove a const-if-hack in RawVec

r? @ecstatic-morse

cc @Centril
2019-12-20 12:17:18 +01:00
Mark Rousskov 9d1baaf11d Rollup merge of #67281 - llogiq:nonoverlapping-insert, r=alexcrichton
add string.insert benchmarks

This adds benchmarks for `String::insert` and `String::insert_str`
2019-12-19 17:53:53 -05:00
Mark Mansi 7d268119f0 no need to bootstrap 2019-12-18 20:19:05 -06:00
Mark Mansi 253543560a add fixme 2019-12-18 20:19:05 -06:00
Mark Mansi 951f041347 fix import 2019-12-18 20:19:05 -06:00
Mark Mansi baaf864e07 use usize::MAX instead of !0 2019-12-18 20:19:05 -06:00
Mark Mansi 3ec3fca414 remove a bit more hackery 2019-12-18 20:19:05 -06:00
Mark Mansi 17aa0cb2ca Remove a const-if-hack in RawVec 2019-12-18 20:19:05 -06:00
Mark Rousskov 82184440ec Propagate cfg bootstrap 2019-12-18 12:16:19 -05:00
Andre Bogus c6321a4df8 Add benchmarks for string::insert(_str) 2019-12-18 07:18:05 +01:00
CAD97 eb77f7ec6e Add internal safety docs to (A)Rc::into_raw 2019-12-17 15:52:13 -05:00