about summary refs log tree commit diff
path: root/library/alloc/src
AgeCommit message (Collapse)AuthorLines
2023-04-28Make sure that signatures aren't accidental refinementsMichael Goulet-17/+65
2023-04-28replace version placeholdersPietro Albini-19/+19
2023-04-26Loosen `From<&[T]> for Box<[T]>` bound to T: CloneJules Bertholet-8/+30
2023-04-26Rollup merge of #110419 - jsoref:spelling-library, r=jyn514Matthias Krüger-5/+5
Spelling library Split per https://github.com/rust-lang/rust/pull/110392 I can squash once people are happy w/ the changes. It's really uncommon for large sets of changes to be perfectly acceptable w/o at least some changes. I probably won't have time to respond until tomorrow or the next day
2023-04-26Make `{Arc,Rc,Weak}::ptr_eq` ignore pointer metadataAlbert Larsan-10/+10
2023-04-26Spelling library/Josh Soref-5/+5
* advance * aligned * borrowed * calculate * debugable * debuggable * declarations * desugaring * documentation * enclave * ignorable * initialized * iterator * kaboom * monomorphization * nonexistent * optimizer * panicking * process * reentrant * rustonomicon * the * uninitialized Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-25Rollup merge of #110796 - madsravn:wake-example, r=Mark-SimulacrumMatthias Krüger-1/+2
Updating Wake example to use new 'pin!' macro Closes: https://github.com/rust-lang/rust/issues/109965 I have already had this reviewed and approved here: https://github.com/rust-lang/rust/pull/110026 . But because I had some git issues and chose the "nuke it" option as my solution it didn't get merged. I nuked it too quickly. I am sorry for trouble of reviewing twice.
2023-04-25Updating Wake example to use new 'pin!' macroMads Ravn-1/+2
2023-04-25Auto merge of #103093 - rytheo:linked-list-alloc-api, r=Mark-Simulacrumbors-135/+224
Add support for allocators in `LinkedList` Allows `LinkedList` to use a custom allocator
2023-04-24Add support for allocators in LinkedListRyan Lowe-135/+224
2023-04-25Revert "Report allocation errors as panics"Matthias Krüger-76/+9
This reverts commit c9a6e41026d7aa27d897fb83e995447719753076.
2023-04-25Revert "Remove #[alloc_error_handler] from the compiler and library"Matthias Krüger-2/+8
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-25Revert "Rename -Zoom=panic to -Zoom=unwind"Matthias Krüger-2/+2
This reverts commit 4b981c26487ebe56de6b3000fcd98713804beefc.
2023-04-22Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwcobors-17/+78
Report allocation errors as panics OOM is now reported as a panic but with a custom payload type (`AllocErrorPanicPayload`) which holds the layout that was passed to `handle_alloc_error`. This should be review one commit at a time: - The first commit adds `AllocErrorPanicPayload` and changes allocation errors to always be reported as panics. - The second commit removes `#[alloc_error_handler]` and the `alloc_error_hook` API. ACP: https://github.com/rust-lang/libs-team/issues/192 Closes #51540 Closes #51245
2023-04-22Rollup merge of #110635 - scottmcm:zst-checks, r=the8472Yuki Okushi-14/+6
More `IS_ZST` in `library` I noticed that `post_inc_start` and `pre_dec_end` were doing this check in different ways https://github.com/rust-lang/rust/blob/d19b64fb54391b64ce99981577c67c93ac2a9ffa/library/core/src/slice/iter/macros.rs#L76-L93 so started making this PR, then added a few more I found since I was already making changes anyway.
2023-04-21More `IS_ZST` in `library`Scott McMurray-14/+6
I noticed that `post_inc_start` and `pre_dec_end` were doing this check in different ways https://github.com/rust-lang/rust/blob/d19b64fb54391b64ce99981577c67c93ac2a9ffa/library/core/src/slice/iter/macros.rs#L76-L93 so started making this PR, then added a few more I found since I was already making changes anyway.
2023-04-20More `mem::take` in `library`Scott McMurray-1/+1
A bunch of places were using `replace(…, &mut [])`, but that can just be `take`.
2023-04-20Don't reexport core::fmt::rt from alloc::fmt.Mara Bos-2/+0
2023-04-18Create try_new function for ThinBoxTrevor Leibert-0/+65
2023-04-16Rename -Zoom=panic to -Zoom=unwindAmanieu d'Antras-2/+2
2023-04-16Remove #[alloc_error_handler] from the compiler and libraryAmanieu d'Antras-8/+2
2023-04-16Report allocation errors as panicsAmanieu d'Antras-9/+76
2023-04-16fix allocDeadbeef-12/+6
2023-04-16core is now compilableDeadbeef-2/+0
2023-04-16rm const traits in libcoreDeadbeef-14/+7
2023-04-14Rollup merge of #110244 - kadiwa4:unnecessary_imports, r=JohnTitorMatthias Krüger-51/+29
Remove some unneeded imports / qualified paths Continuation of #105537.
2023-04-14Rollup merge of #110292 - scottmcm:sort-features-2, r=jyn514Yuki Okushi-21/+25
Add `tidy-alphabetical` to features in `alloc` & `std` So that people have to keep them sorted in future, rather than just sticking them on the end where they conflict more often. Follow-up to #110269 cc `@jyn514`
2023-04-13Add `tidy-alphabetical` to features in `alloc` & `std`Scott McMurray-21/+25
So that people have to keep them sorted in future, rather than just sticking them on the end where they conflict more often.
2023-04-12remove some unneeded importsKaDiWa-51/+29
2023-04-12Fix btree `CursorMut::insert_after` checkmarc0246-1/+65
2023-04-05Derive String's PartialEq implementationKonrad Borowski-9/+1
2023-04-03Auto merge of #108448 - ishitatsuyuki:binary-heap, r=Mark-Simulacrumbors-51/+19
binary_heap: Optimize Extend implementation. This PR makes the `Extend` implementation for `BinaryHeap` no longer rely on specialization, so that it always use the bulk rebuild optimization that was previously only available for the `Vec` specialization.
2023-04-02Auto merge of #109701 - Amanieu:binaryheap_retain, r=ChrisDentonbors-2/+1
Stabilize `binary_heap_retain` FCP finished in tracking issue: #71503
2023-03-31Rollup merge of #109598 - veera-sivarajan:improve-wording, r=thomccMatthias Krüger-2/+2
Improve documentation for str::replace() and str::replacen() Currently, to know what the function will return when the pattern doesn't match, the docs require the reader to understand the implementation detail and mentally evaluate or run the example code. It is not immediately clear. This PR makes it more explicit so the reader can quickly find the information.
2023-03-30Rollup merge of #106985 - jofas:106746-fix, r=ChrisDentonYuki Okushi-10/+10
Enhanced doucmentation of binary search methods for `slice` and `VecDeque` for unsorted instances Fixes #106746. Issue #106746 raises the concern that the binary search methods for slices and deques aren't explicit enough about the fact that they are only applicable to sorted slices/deques. I changed the explanation for these methods. I took the relatively harsh description of the behaviour of binary search on unsorted collections ("unspecified and meaningless") from the description of the [`partition_point`](https://doc.rust-lang.org/std/primitive.slice.html#method.partition_point) method: > If this slice is not partitioned, the returned result is unspecified and meaningless, as this method performs a kind of binary search.
2023-03-30removed deprecated markdown links from documentationjofas-3/+0
2023-03-29Rollup merge of #109693 - workingjubilee:maybe-unconstify-alloc, r=fee1-deadMatthias Krüger-38/+19
Remove ~const from alloc There is currently an effort underway to stop using `~const Trait`, temporarily, so as to refactor the logic underlying const traits with relative ease. This means it has to go from the standard library, as well. I have taken the initial step of just removing these impls from alloc, as removing them from core is a much more tangled task. In addition, all of these implementations are one more-or-less logically-connected group, so reverting their deconstification as a group seems like it will also be sensible. r? `@fee1-dead`
2023-03-29enhanced documentation of binary search methods for slice and VecDeque for ↵jofas-7/+10
unsorted instances
2023-03-28Remove ~const from allocJubilee Young-38/+19
2023-03-28Stabilize `binary_heap_retain`Amanieu d'Antras-2/+1
FCP finished in tracking issue: #71503
2023-03-28Rollup merge of #92284 - the8472:simplify-advance-by, r=scottmcmnils-53/+56
Change advance(_back)_by to return the remainder instead of the number of processed elements When advance_by can't advance the iterator by the number of requested elements it now returns the amount by which it couldn't be advanced instead of the amount by which it did. This simplifies adapters like chain, flatten or cycle because the remainder doesn't have to be calculated as the difference between requested steps and completed steps anymore. Additionally switching from `Result<(), usize>` to `Result<(), NonZeroUsize>` reduces the size of the result and makes converting from/to a usize representing the number of remaining steps cheap.
2023-03-27fix advance_by impl for vec_deque and add testsThe 8472-7/+7
2023-03-27replace advance_by returning usize with Result<(), NonZeroUsize>The 8472-33/+44
2023-03-27Change advance(_back)_by to return `usize` instead of `Result<(), usize>`The 8472-42/+34
A successful advance is now signalled by returning `0` and other values now represent the remaining number of steps that couldn't be advanced as opposed to the amount of steps that have been advanced during a partial advance_by. This simplifies adapters a bit, replacing some `match`/`if` with arithmetic. Whether this is beneficial overall depends on whether `advance_by` is mostly used as a building-block for other iterator methods and adapters or whether we also see uses by users where `Result` might be more useful.
2023-03-27Rollup merge of #97506 - JohnTitor:stabilize-nonnull-slice-from-raw-parts, ↵Matthias Krüger-1/+0
r=m-ou-se,the8472 Stabilize `nonnull_slice_from_raw_parts` FCP is done: https://github.com/rust-lang/rust/issues/71941#issuecomment-1100910416 Note that this doesn't const-stabilize `NonNull::slice_from_raw_parts` as `slice_from_raw_parts_mut` isn't const-stabilized yet. Given #67456 and #57349, it's not likely available soon, meanwhile, stabilizing only the feature makes some sense, I think. Closes #71941
2023-03-25Improve documentation for str::replace() and str::replacen()Veera-2/+2
Currently, to know what the function will return when the pattern doesn't match, the docs require the reader to understand the implementation detail and mentally evaluate or run the example code. It is not immediately clear. This PR makes it more explicit so the reader can quickly find the information.
2023-03-25Auto merge of #99929 - the8472:default-iters, r=scottmcmbors-0/+246
Implement Default for some alloc/core iterators Add `Default` impls to the following collection iterators: * slice::{Iter, IterMut} * binary_heap::IntoIter * btree::map::{Iter, IterMut, Keys, Values, Range, IntoIter, IntoKeys, IntoValues} * btree::set::{Iter, IntoIter, Range} * linked_list::IntoIter * vec::IntoIter and these adapters: * adapters::{Chain, Cloned, Copied, Rev, Enumerate, Flatten, Fuse, Rev} For iterators which are generic over allocators it only implements it for the global allocator because we can't conjure an allocator from nothing or would have to turn the allocator field into an `Option` just for this change. These changes will be insta-stable. ACP: https://github.com/rust-lang/libs-team/issues/77
2023-03-24Rollup merge of #109406 - WaffleLapkin:🥛, r=cuviperMatthias Krüger-6/+0
Remove outdated comments What the title said
2023-03-23Stabilize `arc_into_inner` and `rc_into_inner`.Frank Steffahn-23/+6
Includes resolving the FIXMEs in the documentation, and some very minor documentation improvements.
2023-03-21Auto merge of #106967 - saethlin:remove-vec-as-ptr-assume, r=thomccbors-11/+2
Remove the assume(!is_null) from Vec::as_ptr At a guess, this code is leftover from LLVM was worse at keeping track of the niche information here. In any case, we don't need this anymore: Removing this `assume` doesn't get rid of the `nonnull` attribute on the return type.