| Age | Commit message (Collapse) | Author | Lines |
|
Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
|
|
couple more clippy fixes (let_and_return, if_same_then_else)
* summarize if-else-code with identical blocks (clippy::if_same_then_else)
* don't create variable bindings just to return the bound value immediately (clippy::let_and_return)
|
|
Amend Rc/Arc::from_raw() docs regarding unsafety
[This](https://stackoverflow.com/questions/59671647/is-it-safe-to-clone-a-type-erased-arc-via-raw-pointer) question on SO boils down to "is it safe to `::from_raw()` a `Rc<T>`/`Arc<T>` using a dummy `T` even if `T` is never dereferenced via the new `Rc`/`Arc`?". It almost never is.
This PR amends the docs of `from_raw()` regarding this point.
|
|
|
|
|
|
|
|
(clippy::let_and_return)
|
|
#[must_use] on split_off()
I've noticed this function used for truncation in the wild. `must_use` will clear that up.
|
|
BTreeMap: remove shared root
This replaces the shared root with `Option`s in the BTreeMap code, and then slightly cleans up the node manipulation code taking advantage of the removal of the shared root. I expect that further simplification is possible, but wanted to get this posted for initial review.
Note that `BTreeMap::new()` continues to not allocate.
Benchmarks seem within the margin of error/unaffected, as expected for an entirely predictable branch.
```
name alloc-bench-a ns/iter alloc-bench-b ns/iter diff ns/iter diff % speedup
btree::map::iter_mut_20 20 21 1 5.00% x 0.95
btree::set::clone_100 1,360 1,439 79 5.81% x 0.95
btree::set::clone_100_and_into_iter 1,319 1,434 115 8.72% x 0.92
btree::set::clone_10k 143,515 150,991 7,476 5.21% x 0.95
btree::set::clone_10k_and_clear 142,792 152,916 10,124 7.09% x 0.93
btree::set::clone_10k_and_into_iter 146,019 154,561 8,542 5.85% x 0.94
```
|
|
|
|
|
|
This makes ensure_root_is_owned return a reference to the (now guaranteed to
exist) root, allowing callers to operate on it without going through another
unwrap.
Unfortunately this is only rarely useful as it's frequently the case that both
the length and the root need to be accessed and field-level borrows in methods
don't yet exist.
|
|
We no longer have a separate header because the shared root is gone; all code
can work solely with leafs now.
|
|
|
|
|
|
This simplifies the node manipulation, as we can (in later commits) always know
when traversing nodes that we are not in a shared root.
|
|
The memory fences used previously in Arc implementation are not properly
understood by ThreadSanitizer as synchronization primitives. This had
unfortunate effect where running any non-trivial program compiled with
`-Z sanitizer=thread` would result in numerous false positives.
Replace acquire fences with acquire loads when using ThreadSanitizer to
address the issue.
|
|
Bump the bootstrap compiler
|
|
|
|
Implement From<&mut str> for String
I ran into this missing impl when trying to do `String::from` on the result returned from this API in the `uuid` crate:
https://docs.rs/uuid/0.8.1/uuid/adapter/struct.Hyphenated.html#method.encode_lower
I wasn't sure what to put in the stability annotation. I'd appreciate some help with that :)
|
|
remove lifetimes that can be elided (clippy::needless_lifetimes)
|
|
|
|
Implement Error for TryReserveError
I noticed that the Error trait wasn't implemented for TryReserveError. (#48043)
Not sure if the error messages and code style are 100% correct, it's my first time contributing to the Rust std.
|
|
|
|
|
|
fix memory leak when vec::IntoIter panics during drop
Fixes https://github.com/rust-lang/rust/issues/69770
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
|
|
Co-Authored-By: lzutao <taolzu@gmail.com>
|
|
|
|
Vec::new is const stable in 1.39 not 1.32
Changelog: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1390-2019-11-07
This really surprised me when a MSRV check for 1.35 failed with `Vec::new is not yet stable as a const fn` and the docs said that it was const stabilized in 1.32.
|
|
Add note about localization to std::fmt docs
Closes #69681
|
|
Allow ZSTs in `AllocRef`
Allows ZSTs in all `AllocRef` methods. The implementation of `AllocRef` for `Global` and `System` were adjusted to reflect those changes.
This is the second item on the roadmap to support ZSTs in `AllocRef`: https://github.com/rust-lang/wg-allocators/issues/38#issuecomment-595861542
After this has landed, I will adapt `RawVec`, but since this will be a pretty big overhaul, it makes sense to do a different PR for it.
~~Requires #69794 to land first~~
r? @Amanieu
|
|
|
|
|
|
More documentation and simplification of BTreeMap's internals
Salvage the documentation and simplification from #67980, without changing the type locked down by debuginfo.
r? @rkruppe
|
|
|
|
Fix & test leak of some BTreeMap nodes on panic during `into_iter`
Fixes #69769
|
|
|
|
fix various typos
|
|
reduce test size for Miri
The larger sizes take quite a while, and there is probably little point in repeating this quite so often.
|
|
|
|
|
|
|
|
|