| Age | Commit message (Collapse) | Author | Lines |
|
change remove to have a PartialEq bound
Addresses [comment](https://github.com/rust-lang/rust/pull/67727#issuecomment-570660301).
References #40062
r? @Amanieu
|
|
|
|
|
|
|
|
Tweak and extend internal BTreeMap documentation, including debug asserts.
Gathered from work on various other pull requests (e.g. #67725, #67686).
|
|
|
|
|
|
Co-Authored-By: Robin Kruppe <robin.kruppe@gmail.com>
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
|
|
|
|
Warn against relying on ?Sized being last
Fixes #62522
|
|
|
|
|
|
Remove a const-if-hack in RawVec
r? @ecstatic-morse
cc @Centril
|
|
add string.insert benchmarks
This adds benchmarks for `String::insert` and `String::insert_str`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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`).
|
|
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
|
|
|
|
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
|
|
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.
|
|
VecDeque: drop remaining items on destructor panic
Closes https://github.com/rust-lang/rust/issues/67232
|
|
functions with a `const` modifier
|
|
|
|
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.
|
|
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.
|
|
Small std::borrow::Cow improvements
This is a small set of improvements (+ one more tested code path) for `Cow`.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc: Use .copied() instead of .cloned() in Vec example
None
|
|
|
|
|
|
|