Commit Graph

2108 Commits

Author SHA1 Message Date
Stein Somers 9e90840a6a Simplify NodeHeader by avoiding slices in BTreeMaps with shared roots 2020-01-10 17:19:50 +01: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
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
Mazdak Farrokhzad c34ea91a9d Rollup merge of #65778 - bdonlan:stable_weak_count, r=dtolnay
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-16 05:23:26 +01:00
Mazdak Farrokhzad 64f83915de Rollup merge of #67300 - aloucks:issue-65970, r=rkruppe
Restore original implementation of Vec::retain

This PR reverts #48065, which aimed to optimize `Vec::retain` by making use of `Vec::drain_filter`. Unfortunately at that time, `drain_filter` was unsound.

The soundness hole in `Vec::drain_filter` was fixed in #61224 by guaranteeing that cleanup logic runs via a nested `Drop`, even in the event of a panic. Implementing this nested drop affects codegen (apparently?) and results in slower code.

Fixes #65970
2019-12-15 05:57:27 +01:00
David Tolnay 9778e03665 Bump Weak::strong_count/weak_count stabilizations from 1.40 to 1.41 2019-12-14 19:26:25 -08:00
Aaron Loucks 7ea6c46a6d Restore original implementation of Vec::retain
This PR reverts #48065, which aimed to optimize `Vec::retain` by
making use of `Vec::drain_filter`. Unfortunately at that time,
`drain_filter` was unsound.

The soundness hole in `Vec::drain_filter` was fixed in #61224 by
guaranteeing that cleanup logic runs via a nested `Drop`, even in
the event of a panic. Implementing this nested drop affects codegen
(apparently?) and results in slower code.

Fixes #65970
2019-12-14 12:38:45 -05:00
bors c8ea4ace92 Auto merge of #67136 - oli-obk:const_stability, r=Centril
Require stable/unstable annotations for the constness of all stable fns with a const modifier

r? @RalfJung @Centril

Every `#[stable]` const fn now needs either a `#[rustc_const_unstable]` attribute or a `#[rustc_const_stable]` attribute. You can't silently stabilize the constness of a function anymore.
2019-12-14 10:21:32 +00:00
Mazdak Farrokhzad 48164f8a17 Rollup merge of #67235 - jonas-schievink:vecdeque-leak, r=KodrAus
VecDeque: drop remaining items on destructor panic

Closes https://github.com/rust-lang/rust/issues/67232
2019-12-13 20:35:30 +01:00
Oliver Scherer 5e17e39881 Require stable/unstable annotations for the constness of all stable functions with a const modifier 2019-12-13 11:27:02 +01:00
Oliver Scherer d75c7530f3 Reuse the staged_api feature for rustc_const_unstable 2019-12-13 11:27:01 +01:00
Mazdak Farrokhzad 87f3b16e0b Rollup merge of #67243 - jonas-schievink:linkedlist-drop, r=KodrAus
LinkedList: drop remaining items when drop panics

https://github.com/rust-lang/rust/pull/67235, but for `LinkedList`, which has the same issue.

I've also copied over the other drop-related tests from `VecDeque` since AFAICT `LinkedList` didn't have any.
2019-12-13 04:21:27 +01:00
Mazdak Farrokhzad 2ca7b7e539 Rollup merge of #66341 - crgl:vec-deque-extend, r=Amanieu
Match `VecDeque::extend` to `Vec::extend_desugared`

Currently, `VecDeque::extend` [does not reserve at all](https://github.com/rust-lang/rust/pull/65069#discussion_r333166522). This implementation still runs a check every iteration of the loop, but should reallocate at most once for the common cases where the `size_hint` lower bound is exact. Further optimizations in the future could improve this for some common cases, but given the complexity of the `Vec::extend` implementation it's not immediately clear that this would be worthwhile.
2019-12-13 04:21:22 +01:00
Yuki Okushi 60ebeda94f Rollup merge of #67238 - llogiq:moo-and-improved, r=Dylan-DPC
Small std::borrow::Cow improvements

This is a small set of improvements (+ one more tested code path) for `Cow`.
2019-12-12 10:09:28 +09:00
Yuki Okushi 9860a4eeb7 Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
Clarify `Box<T>` representation and its use in FFI

This officializes what was only shown as a code example in [the unsafe code guidelines](https://rust-lang.github.io/unsafe-code-guidelines/layout/function-pointers.html?highlight=box#use) and follows [the discussion](https://github.com/rust-lang/unsafe-code-guidelines/issues/157) in the corresponding repository.

It is also related to [the issue](https://github.com/rust-lang/rust/issues/52976) regarding marking `Box<T>` `#[repr(transparent)]`.

If the statement this PR adds is incorrect or a more in-depth discussion is warranted, I apologize. Should it be the case, the example in the unsafe code guidelines should be amended and some document should make it clear that it is not sound/supported.
2019-12-12 10:09:15 +09:00