about summary refs log tree commit diff
path: root/library/alloc/src
AgeCommit message (Collapse)AuthorLines
2020-12-26Auto merge of #79520 - ssomers:btree_cleanup_1, r=Mark-Simulacrumbors-64/+17
BTreeMap: clean up access to MaybeUninit arrays Stop exposing and using immutable access to `MaybeUninit` slices when we need and have exclusive access to the tree. r? `@Mark-Simulacrum`
2020-12-26Auto merge of #80354 - ssomers:btree_test_compact, r=Mark-Simulacrumbors-9/+33
BTreeMap: test full nodes a little more r? `@Mark-Simulacrum`
2020-12-26Auto merge of #79022 - SpyrosRoum:stabilize-deque_range, r=m-ou-sebors-6/+2
stabilize deque_range Make #74217 stable, stabilizing `VecDeque::range` and `VecDeque::range_mut`. Pr: #74099 r? `@m-ou-se`
2020-12-25BTreeMap: declare exclusive access to arrays when copying from themStein Somers-64/+17
2020-12-25Rollup merge of #80352 - ssomers:btree_test_diagnostics, r=Mark-SimulacrumDylan DPC-5/+9
BTreeMap: make test cases more explicit on failure r? `@Mark-Simulacrum`
2020-12-24BTreeMap: test full nodes a little moreStein Somers-9/+33
2020-12-24BTreeMap: test split_off (and append) more thoroughlyStein Somers-7/+38
2020-12-24BTreeMap: make test cases more explicit on failureStein Somers-5/+9
2020-12-24BTreeMap: avoid implicit use of node length in flightStein Somers-97/+81
2020-12-23Auto merge of #79521 - ssomers:btree_cleanup_2, r=Mark-Simulacrumbors-106/+108
BTreeMap: relax the explicit borrow rule to make code shorter and safer Expressions like `.reborrow_mut().into_len_mut()` are annoyingly long, and kind of dangerous for the reason `reborrow_mut()` is unsafe. By relaxing the single rule, we no longer have to make an exception for functions with a `borrow` name and functions like `as_leaf_mut`. This is largely restoring the declaration style of the btree::node API about a year ago, but with more explanation and consistency. r? `@Mark-Simulacrum`
2020-12-19Rollup merge of #78083 - ChaiTRex:master, r=m-ou-seYuki Okushi-5/+7
Stabilize or_insert_with_key Stabilizes the `or_insert_with_key` feature from https://github.com/rust-lang/rust/issues/71024. This allows inserting key-derived values when a `HashMap`/`BTreeMap` entry is vacant. The difference between this and `.or_insert_with(|| ... )` is that this provides a reference to the key to the closure after it is moved with `.entry(key_being_moved)`, avoiding the need to copy or clone the key.
2020-12-18Stabilize Arc::{incr,decr}_strong_countYoshua Wuyts-13/+9
2020-12-18Rollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic, r=dtolnayDylan DPC-2/+6
Fix overflow when converting ZST Vec to VecDeque ```rust let v = vec![(); 100]; let queue = VecDeque::from(v); println!("{:?}", queue); ``` This code will currently panic with a capacity overflow. This PR resolves this issue and makes the code run fine. Resolves #78532
2020-12-17BTreeMap: relax the explicit borrow rule to make code shorter and saferStein Somers-106/+108
2020-12-17Rollup merge of #80022 - ssomers:btree_cleanup_8, r=Mark-SimulacrumGuillaume Gomez-2/+2
BTreeSet: simplify implementation of pop_first/pop_last …and stop it interfering in #79245. r? ```````@Mark-Simulacrum```````
2020-12-17Rollup merge of #80006 - ssomers:btree_cleanup_6, r=Mark-SimulacrumGuillaume Gomez-28/+27
BTreeMap: more expressive local variables in merge r? ```````@Mark-Simulacrum```````
2020-12-15Auto merge of #78682 - glandium:issue78471, r=lcnrbors-1/+5
Do not inline finish_grow Fixes #78471. Looking at libgkrust.a in Firefox, the sizes for the `gkrust.*.o` file is: - 18584816 (text) 582418 (data) with unmodified master - 17937659 (text) 582554 (data) with #72227 reverted - 17968228 (text) 582858 (data) with `#[inline(never)]` on `grow_amortized` and `grow_exact`, but that has some performance consequences - 17927760 (text) 582322 (data) with this change So in terms of size, at least in the case of Firefox, this patch more than undoes the regression. I don't think it should affect performance, but we'll see.
2020-12-14Rollup merge of #79918 - woodruffw-forks:ww/doc-initializer-side-effects, ↵Guillaume Gomez-0/+4
r=dtolnay doc(array,vec): add notes about side effects when empty-initializing Copying some context from a conversation in the Rust discord: * Both `vec![T; 0]` and `[T; 0]` are syntactically valid, and produce empty containers of their respective types * Both *also* have side effects: ```rust fn side_effect() -> String { println!("side effect!"); "foo".into() } fn main() { println!("before!"); let x = vec![side_effect(); 0]; let y = [side_effect(); 0]; println!("{:?}, {:?}", x, y); } ``` produces: ``` before! side effect! side effect! [], [] ``` This PR just adds two small notes to each's documentation, warning users that side effects can occur. I've also submitted a clippy proposal: https://github.com/rust-lang/rust-clippy/issues/6439
2020-12-14BTreeSet: simplify implementation of pop_first/pop_lastStein Somers-2/+2
2020-12-13Auto merge of #80005 - ssomers:btree_cleanup_3, r=Mark-Simulacrumbors-10/+11
BTreeMap: declare clear_parent_link directly on the root it needs r? `@Mark-Simulacrum`
2020-12-13Auto merge of #79987 - ssomers:btree_cleanup_4, r=Mark-Simulacrumbors-0/+2
BTreeMap: detect bulk_steal's count-1 underflow in release builds too r? `@Mark-Simulacrum`
2020-12-13Auto merge of #79376 - ssomers:btree_choose_parent_kv, r=Mark-Simulacrumbors-12/+14
BTreeMap: clarify comments and panics around choose_parent_kv Fixes a lie in recent code: `unreachable!("empty non-root node")` should shout "empty internal node", but it might as well be good and keep quiet r? `@Mark-Simulacrum`
2020-12-13fix typoJustus K-1/+1
2020-12-13BTreeMap: more expressive local variables in mergeStein Somers-28/+27
2020-12-13BTreeMap: declare clear_parent_link directly on the root it needsStein Somers-10/+11
2020-12-13fix panic if converting ZST Vec to VecDequeJustus K-2/+6
2020-12-13Auto merge of #79994 - JohnTitor:rollup-43wl2uj, r=JohnTitorbors-62/+0
Rollup of 12 pull requests Successful merges: - #79360 (std::iter: document iteration over `&T` and `&mut T`) - #79398 (Link loop/for keyword) - #79834 (Remove deprecated linked_list_extras methods.) - #79845 (Fix rustup support in default_build_triple for python3) - #79940 (fix more clippy::complexity findings) - #79942 (Add post-init hook for static memory for miri.) - #79954 (Fix building compiler docs with stage 0) - #79963 (Fix typo in `DebruijnIndex` documentation) - #79970 (Misc rustbuild improvements when the LLVM backend isn't used) - #79973 (rustdoc light theme: Fix CSS for selected buttons) - #79984 (Remove an unused dependency that made `rustdoc` crash) - #79985 (Fixes submit event of the search input) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-12-13Rollup merge of #79834 - m-ou-se:bye-linked-list-extras, r=Mark-SimulacrumYuki Okushi-62/+0
Remove deprecated linked_list_extras methods. https://github.com/rust-lang/rust/issues/27794#issuecomment-667524201: > I'd say give it about 2 weeks then remove them. It's been 18 weeks. Time to remove them. :) Closes #27794.
2020-12-13BTreeMap: capture a recurring use pattern as replace_kvStein Somers-8/+10
2020-12-13BTreeMap: detect bulk_steal's count-1 underflow in release builds tooStein Somers-0/+2
2020-12-12BTreeMap: clarify comments and panics surrounding choose_parent_kvStein Somers-12/+14
2020-12-11doc: apply suggestionsWilliam Woodruff-2/+3
2020-12-10Rollup merge of #79860 - rust-lang:frewsxcv-patch-2, r=jyn514Tyler Mandry-1/+1
Clarify that String::split_at takes a byte index. To someone skimming through the `String` docs and only reads the first line, the person could interpret "index" to be "char index". Later on in the docs it clarifies, but by adding "byte" it removes that ambiguity.
2020-12-10doc(array,vec): add notes about side effects when empty-initializingWilliam Woodruff-0/+3
2020-12-10Fix the fmt issuesClément Renault-2/+2
2020-12-10Auto merge of #79814 - lcnr:deque-f, r=Mark-Simulacrumbors-5/+27
fix soundness issue in `make_contiguous` fixes #79808
2020-12-10Use none as the issue instead of 0Clément Renault-1/+1
2020-12-10Introduce the GroupBy and GroupByMut IteratorsClément Renault-0/+3
2020-12-09Rollup merge of #79795 - matklad:unicode-private, r=cramertjTyler Mandry-1/+1
Privatize some of libcore unicode_internals My understanding is that these API are perma unstable, so it doesn't make sense to pollute docs & IDE completion[1] with them. [1]: https://github.com/rust-analyzer/rust-analyzer/issues/6738
2020-12-09Clarify that String::split_at takes a byte index.Corey Farwell-1/+1
2020-12-08Remove deprecated linked_list_extras methods.Mara Bos-62/+0
2020-12-08fix unsoundness in `make_contiguous`Bastian Kauschke-5/+27
2020-12-08Do not inline finish_growMike Hommey-1/+5
We also change the specialization of `SpecFromIterNested::from_iter` for `TrustedLen` to use `Vec::with_capacity` when the iterator has a proper size hint, instead of `Vec::new`, avoiding calls to `grow_*` and thus `finish_grow` in some fully inlinable cases, which would regress with this change. Fixes #78471.
2020-12-07Removed spurious linebreak from new documentationChai T. Rex-1/+1
2020-12-07Improved documentation for HashMap/BTreeMap Entry's .or_insert_with_key methodChai T. Rex-3/+6
2020-12-07Privatize some of libcore unicode_internalsAleksey Kladov-1/+1
My understanding is that these API are perma unstable, so it doesn't make sense to pollute docs & IDE completion[1] with them. [1]: https://github.com/rust-analyzer/rust-analyzer/issues/6738
2020-12-05Auto merge of #78373 - matthewjasper:drop-on-into, r=pnkfelixbors-1/+1
Don't leak return value after panic in drop Closes #47949
2020-12-04Avoid leaking block expression valuesMatthew Jasper-1/+1
2020-12-04 Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate`Tim Diekmann-250/+253
2020-12-01Update rustc version that or_insert_with_key landedChai T. Rex-1/+1