about summary refs log tree commit diff
path: root/library/alloc/src
AgeCommit message (Collapse)AuthorLines
2021-06-20Auto merge of #85980 - ssomers:btree_cleanup_LeafRange, r=Mark-Simulacrumbors-51/+111
BTree: encapsulate LeafRange better & some debug asserts Looking at iterators again, I think #81937 didn't house enough code in `LeafRange`. Moving the API boundary a little makes things more local in navigate.rs and less complicated in map.rs. r? `@Mark-Simulacrum`
2021-06-18Use `copy_nonoverlapping` to copy `bytes` in `String::insert_bytes`Paolo Barbolini-1/+1
2021-06-17Rollup merge of #85970 - jsha:remove-methods-implementors, r=GuillaumeGomezYuki Okushi-0/+4
Remove methods under Implementors on trait pages As discussed at https://github.com/rust-lang/rust/issues/84326#issuecomment-842652412. On a trait page, the "Implementors" section currently lists all methods of each implementor. That duplicates the method definitions on the trait itself, and is usually not very useful. So the implementors are collapsed by default. This PR changes rustdoc to just not render them at all. Any documentation specific to an implementor can be found by clicking through to the implementor's page. This moves the "portability" info inside the `<summary>` tags so it is still visible on trait pages (as originally implemented in #79201). That also means it will be visible on struct/enum pages when methods are collapsed. Add `#[doc(hidden)]` to all implementations of `Iterator::__iterator_get_unchecked` that didn't already have it. Otherwise, due to #86145, the structs/enums with those implementations would generate documentation for them, and that documentation would have a broken link into the Iterator page. Those links were already "broken" but not detected by the link-checker, because they pointed to one of the Implementors on the Iterator page, which happened to have the right anchor name. This reduces the Read trait's page size from 128kB to 68kB (uncompressed) and from 12,125 bytes to 9,989 bytes (gzipped Demo: https://hoffman-andrews.com/rust/remove-methods-implementors/std/string/struct.String.html#trait-implementations https://hoffman-andrews.com/rust/remove-methods-implementors/std/io/trait.Read.html#implementors r? `@GuillaumeGomez`
2021-06-17Rollup merge of #85663 - fee1-dead:document-arc-from, r=m-ou-seYuki Okushi-0/+14
Document Arc::from
2021-06-16Add doc(hidden) to all __iterator_get_uncheckedJacob Hoffman-Andrews-0/+4
This method on the Iterator trait is doc(hidden), and about half of implementations were doc(hidden). This adds the attribute to the remaining implementations.
2021-06-17Rollup merge of #86140 - scottmcm:array-hash-facepalm, r=kennytmYuki Okushi-0/+17
Mention the `Borrow` guarantee on the `Hash` implementations for Arrays and `Vec` To remind people like me who forget about it and send PRs to make them different, and to (probably) get a test failure if the code is changed to no longer uphold it.
2021-06-14Stabilize `maybe_uninit_ref`Yuki Okushi-1/+0
2021-06-12Remove "generic type" in boxed.rsDeadbeef-1/+1
2021-06-09BTree: encapsulate LeafRange better & some debug assertsStein Somers-51/+111
2021-06-09Rollup merge of #85715 - fee1-dead:document-string, r=JohnTitorYuki Okushi-7/+43
Document `From` impls in string.rs
2021-06-08Mention the Borrow guarantee on the Hash implementations for Array and VecScott McMurray-0/+17
To remind people like me who forget about it and send PRs to make them different, and to (probably) get a test failure if the code is changed to no longer uphold it.
2021-06-08Auto merge of #83515 - tamird:string-remove-matches-rev, r=m-ou-sebors-22/+39
String::remove_matches O(n^2) -> O(n) Copy only non-matching bytes. Replace collection of matches into a vector with iteration over rejections, exploiting the guarantee that we mutate parts of the haystack that have already been searched over. r? `@joshtriplett`
2021-06-06String::remove_matches O(n^2) -> O(n)Tamir Duberstein-15/+38
Copy only non-matching bytes.
2021-06-06Use iter::from_fn in String::remove_matchesTamir Duberstein-9/+3
2021-06-06Rollup merge of #85930 - mominul:array_into_iter, r=m-ou-seYuki Okushi-7/+6
Update standard library for IntoIterator implementation of arrays This PR partially resolves issue #84513 of updating the standard library part. I haven't found any remaining doctest examples which are using iterators over e.g. &i32 instead of just i32 in the standard library. Can anyone point me to them if there's remaining any? Thanks! r? ```@m-ou-se```
2021-06-05Document Arc::fromDeadbeef-0/+14
2021-06-04rustdoc: link to stable/beta docs consistently in documentationJoshua Nelson-1/+0
## User-facing changes - Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as). - Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels). - Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links. Note that "links" includes both intra-doc links and rustdoc's own automatically generated hyperlinks. ## Implementation changes - Update the testsuite to allow linking to /beta and /1.52.1 in docs - Use an html_root_url for the standard library that's dependent on the channel This avoids linking to nightly docs on stable. - Update rustdoc to use channel-dependent links for primitives from an unknown crate - Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync - Include doc.rust-lang.org in the channel
2021-06-04added back bindings_after_at as a cfg_attrmarcusdunn-0/+1
2021-06-04removed ref to bindings_after_atmarcusdunn-1/+0
2021-06-04Rollup merge of #85717 - fee1-dead:document-cow, r=yaahcYuki Okushi-0/+18
Document `From` impls for cow.rs
2021-06-03Auto merge of #85867 - steffahn:remove_unnecessary_specfromiter_impls, ↵bors-34/+1
r=Mark-Simulacrum Remove unnecessary SpecFromIter impls Unless I’m missing something, these `SpecFromIter<&'a T, …> for Vec<T>` implementations were completely unused.
2021-06-02Stabilize VecDeque::partition_point.Mara Bos-2/+1
2021-06-02Bump vecdeque_binary_search stabilization to 1.54.Mara Bos-3/+3
2021-06-02Bumped `vecdeque_binary_search` stabilization version to 1.53.0SOFe-3/+3
2021-06-02Stabilize `vecdeque_binary_search`SOFe-7/+3
2021-06-02Update expressions where we can use array's IntoIterator implementationMuhammad Mominul Huque-5/+5
2021-06-02Replace IntoIter::new with IntoIterator::into_iter in stdMuhammad Mominul Huque-2/+1
2021-05-31Update documentation of SpecFromIter to reflect the removed implsFrank Steffahn-3/+1
2021-05-31Remove unnecessary SpecFromIter implsFrank Steffahn-31/+0
2021-05-31Auto merge of #85814 - steffahn:fix_linked_list_itermut_debug, r=m-ou-sebors-7/+20
Fix unsoundness of Debug implementation for linked_list::IterMut Fix #85813, new `marker` field follows the example of `linked_list::Iter`.
2021-05-30Rollup merge of #85817 - r00ster91:patch-9, r=dtolnayGuillaume Gomez-1/+1
Fix a typo See also: #85737
2021-05-30Rollup merge of #85801 - WaffleLapkin:master, r=joshtriplettGuillaume Gomez-0/+37
Add `String::extend_from_within` This PR adds `String::extend_from_within` function under the `string_extend_from_within` feature gate similar to the [`Vec::extend_from_within`] function. ```rust // String pub fn extend_from_within<R>(&mut self, src: R) where R: RangeBounds<usize>; ``` [`Vec::extend_from_within`]: https://github.com/rust-lang/rust/issues/81656
2021-05-30Improve Debug impls for LinkedList reference iterators to show itemsFrank Steffahn-2/+18
2021-05-30Fix a typor00ster-1/+1
2021-05-29Fix unsoundness of Debug implementation for linked_list::IterMutFrank Steffahn-6/+3
2021-05-29Add `String::extend_from_within`Waffle-0/+37
This patch adds `String::extend_from_within` function under the `string_extend_from_within` feature gate similar to the `Vec::extend_from_within` function.
2021-05-27Revert "Auto merge of #83770 - the8472:tra-extend, r=Mark-Simulacrum"The8472-59/+25
Due to a performance regression that didn't show up in the original perf run this reverts commit 9111b8ae9793f18179a1336417618fc07a9cac85, reversing changes made to 9a700d2947f2d7f97a2c0dfca3117a8dcc255bdd.
2021-05-27Auto merge of #85737 - scottmcm:vec-calloc-option-nonzero, r=m-ou-sebors-0/+33
Enable Vec's calloc optimization for Option<NonZero> Someone on discord noticed that `vec![None::<NonZeroU32>; N]` wasn't getting the optimization, so here's a PR šŸ™ƒ We can certainly do this in the standard library because we know for sure this is ok, but I think it's also a necessary consequence of documented guarantees like those in https://doc.rust-lang.org/std/option/#representation and https://doc.rust-lang.org/core/num/struct.NonZeroU32.html It feels weird to do this without adding a test, but I wasn't sure where that would belong. Is it worth adding codegen tests for these?
2021-05-26Enable Vec's calloc optimization for Option<NonZero>Scott McMurray-0/+33
2021-05-26Auto merge of #83770 - the8472:tra-extend, r=Mark-Simulacrumbors-25/+59
Add `TrustedRandomAccess` specialization for `Vec::extend()` This should do roughly the same as the `TrustedLen` specialization but result in less IR by using `__iterator_get_unchecked` instead of `Iterator::for_each` Conflicting specializations are manually prioritized by grouping them under yet another helper trait.
2021-05-26Document `From` impls for cow.rsDeadbeef-0/+18
2021-05-26Rollup merge of #85625 - SkiFire13:fix-85613-vec-dedup-drop-panics, r=nagisaDylan DPC-2/+3
Prevent double drop in `Vec::dedup_by` if a destructor panics Fixes #85613
2021-05-26Document `From` impls in string.rsDeadbeef-7/+43
2021-05-26Rollup merge of #85666 - fee1-dead:document-shared-from-cow, r=dtolnayYuki Okushi-0/+24
Document shared_from_cow functions
2021-05-26Auto merge of #85535 - dtolnay:weakdangle, r=kennytmbors-2/+2
Weak's type parameter may dangle on drop Way back in https://github.com/rust-lang/rust/commit/34076bc0c9fb9ee718e1cebc407547eef730a080, #\[may_dangle\] was added to Rc\<T\> and Arc\<T\>'s Drop impls. That appears to have been because a test added in #28929 used Arc and Rc with dangling references at drop time. However, Weak was not covered by that test, and therefore no #\[may_dangle\] was forced to be added at the time. As far as dropping, Weak has *even less need* to interact with the T than Rc and Arc do. Roughly speaking #\[may_dangle\] describes generic parameters that the outer type's Drop impl does not interact with except by possibly dropping them; no other interaction (such as trait method calls on the generic type) is permissible. It's clear this applies to Rc's and Arc's drop impl, which sometimes drop T but otherwise do not interact with one. It applies *even more* to Weak. Dropping a Weak cannot ever cause T's drop impl to run. Either there are strong references still in existence, in which case better not drop the T. Or there are no strong references still in existence, in which case the T would already have been dropped previously by the drop of the last strong count.
2021-05-25Document shared_from_cow functionsDeadbeef-0/+24
2021-05-24remove cfg(bootstrap)Pietro Albini-3/+1
2021-05-24Avoid a double drop in Vec::dedup if a destructor panicsGiacomo Stevanato-2/+3
2021-05-21Remove surplus prepend LinkedList fnJubilee Young-21/+0
Originally committed to Rust in 2013, it is identical to append with a reversed order of arguments.
2021-05-20Weak's type parameter may dangle on dropDavid Tolnay-2/+2