about summary refs log tree commit diff
path: root/library/alloc
AgeCommit message (Collapse)AuthorLines
2024-08-31Fix `elided_named_lifetimes` in codePavel Grigorenko-1/+1
2024-08-31Rollup merge of #129640 - saethlin:unignore-android-in-alloc, r=tgross35Matthias Krüger-12/+0
Re-enable android tests/benches in alloc/core This is basically a revert of https://github.com/rust-lang/rust/pull/73729. These tests better work on android now; it's been 4 years and we don't use dlmalloc on that target anymore. And I've validated that they should pass now with a try-build :)
2024-08-31Fixed typos in btree map docsranger-ross-4/+4
2024-08-29add new_cyclic_in for ArcMatthew Giordano-0/+93
2024-08-29improve commentsMatthew Giordano-1/+2
2024-08-29fix new_cyclic_in for rcMatthew Giordano-48/+79
2024-08-29fix fmtMatthew Giordano-10/+2
2024-08-29Box validity: update for new zero-sized rulesRalf Jung-15/+12
2024-08-28Rollup merge of #129715 - Amjad50:update-compiler-builtins, r=tgross35Jubilee-1/+1
Update `compiler_builtins` to `0.1.123` Includes https://github.com/rust-lang/compiler-builtins/pull/680 and fixes https://github.com/rust-lang/rust/issues/128386. Fixed by not including math symbols of `compiler_builtins` into any `unix` target or `wasi`, old behavior is restored r? tgross35
2024-08-28Rollup merge of #129673 - matthewpipie:arc-weak-debug-trait, r=dtolnayJubilee-1/+1
Add fmt::Debug to sync::Weak<T, A> Currently, `sync::Weak<T>` implements `Debug`, but `sync::Weak<T, A>` does not. This appears to be an oversight, as `rc::Weak<T, A>` implements `Debug`. (Note: `sync::Weak` is the weak for `Arc`, and `rc::Weak` is the weak for `Rc`.) This PR adds the Debug trait for `sync::Weak<T, A>`. The issue was initially brought up here: https://github.com/rust-lang/wg-allocators/issues/131
2024-08-29Update `compiler_builtins` to `0.1.123`Amjad Alsharafi-1/+1
Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com>
2024-08-28Re-enable android tests/benches in allocBen Kimock-12/+0
2024-08-27add new_cyclic_in for rcMatthew Giordano-2/+58
2024-08-27Add fmt::Debug to sync::Weak<T, A>Matthew Giordano-1/+1
2024-08-27library: Stabilize new_uninit for Box, Rc, and ArcJubilee Young-65/+32
A partial stabilization that only affects: - AllocType<T>::new_uninit - AllocType<T>::assume_init - AllocType<[T]>::new_uninit_slice - AllocType<[T]>::assume_init where "AllocType" is Box, Rc, or Arc
2024-08-26Rollup merge of #129544 - mu001999-contrib:dead-code/clean, r=compiler-errorsMatthias Krüger-0/+1
Removes dead code from the compiler Detected by #128637
2024-08-25Rollup merge of #129416 - workingjubilee:partial-move-from-stabilization, ↵Matthias Krüger-9/+16
r=dtolnay library: Move unstable API of new_uninit to new features - `new_zeroed` variants move to `new_zeroed_alloc` - the `write` fn moves to `box_uninit_write` The remainder will be stabilized in upcoming patches, as it was decided to only stabilize `uninit*` and `assume_init`.
2024-08-25Rollup merge of #129091 - RalfJung:box_as_ptr, r=AmanieuMatthias Krüger-2/+90
add Box::as_ptr and Box::as_mut_ptr methods Unstably implements https://github.com/rust-lang/libs-team/issues/355. Tracking issue: https://github.com/rust-lang/rust/issues/129090. r? libs-api
2024-08-25Removes dead code from the compilermu001999-0/+1
2024-08-23library: Move unstable API of new_uninit to new featuresJubilee Young-9/+16
- `new_zeroed` variants move to `new_zeroed_alloc` - the `write` fn moves to `box_uninit_write` The remainder will be stabilized in upcoming patches, as it was decided to only stabilize `uninit*` and `assume_init`.
2024-08-23Update `compiler_builtins` to `0.1.121`Scott McMurray-1/+1
2024-08-22Implement feature `string_from_utf8_lossy_owned`okaneco-0/+74
Implement feature for lossily converting from `Vec<u8>` to `String` - Add `String::from_utf8_lossy_owned` - Add `FromUtf8Error::into_utf8_lossy`
2024-08-22Update `compiler_builtins` to `0.1.120`Amjad Alsharafi-1/+1
Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com>
2024-08-19Stabilize `iter::repeat_n`Scott McMurray-1/+0
2024-08-19docs: Mention `spare_capacity_mut()` in `Vec::set_len`Jan Ferdinand Sauer-1/+6
2024-08-14apply #[optimize(size)] to #[cold] ones and part of the panick machineryThe 8472-0/+7
2024-08-14add Box::as_ptr and Box::as_mut_ptr methodsRalf Jung-2/+90
2024-08-14Rollup merge of #128759 - notriddle:notriddle/spec-to-string, ↵Matthias Krüger-7/+47
r=workingjubilee,compiler-errors alloc: add ToString specialization for `&&str` Fixes #128690
2024-08-13Auto merge of #128742 - RalfJung:miri-vtable-uniqueness, r=saethlinbors-2/+2
miri: make vtable addresses not globally unique Miri currently gives vtables a unique global address. That's not actually matching reality though. So this PR enables Miri to generate different addresses for the same type-trait pair. To avoid generating an unbounded number of `AllocId` (and consuming unbounded amounts of memory), we use the "salt" technique that we also already use for giving constants non-unique addresses: the cache is keyed on a "salt" value n top of the actually relevant key, and Miri picks a random salt (currently in the range `0..16`) each time it needs to choose an `AllocId` for one of these globals -- that means we'll get up to 16 different addresses for each vtable. The salt scheme is integrated into the global allocation deduplication logic in `tcx`, and also used for functions and string literals. (So this also fixes the problem that casting the same function to a fn ptr over and over will consume unbounded memory.) r? `@saethlin` Fixes https://github.com/rust-lang/miri/issues/3737
2024-08-12std::fmt::FormatterFn -> std::fmt::FromFnschvv31n-1/+1
2024-08-12ignore some vtable/fn ptr equality tests in Miri, their result is not fully ↵Ralf Jung-2/+2
predictable
2024-08-12Auto merge of #126793 - saethlin:mono-rawvec, r=scottmcmbors-212/+384
Apply "polymorphization at home" to RawVec The idea here is to move all the logic in RawVec into functions with explicit size and alignment parameters. This should eliminate all the fussing about how tweaking RawVec code produces large swings in compile times. This uncovered https://github.com/rust-lang/rust-clippy/issues/12979, so I've modified the relevant test in a way that tries to preserve the spirit of the test without tripping the ICE.
2024-08-10Auto merge of #128927 - GuillaumeGomez:rollup-ei2lr0f, r=GuillaumeGomezbors-40/+56
Rollup of 8 pull requests Successful merges: - #128273 (Improve `Ord` violation help) - #128807 (run-make: explaing why fmt-write-bloat is ignore-windows) - #128903 (rustdoc-json-types `Discriminant`: fix typo) - #128905 (gitignore: Add Zed and Helix editors) - #128908 (diagnostics: do not warn when a lifetime bound infers itself) - #128909 (Fix dump-ice-to-disk for RUSTC_ICE=0 users) - #128910 (Differentiate between methods and associated functions in diagnostics) - #128923 ([rustdoc] Stop showing impl items for negative impls) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-10Rollup merge of #128273 - Voultapher:improve-ord-violation-help, ↵Guillaume Gomez-40/+56
r=workingjubilee Improve `Ord` violation help Recent experience in #128083 showed that the panic message when an Ord violation is detected by the new sort implementations can be confusing. So this PR aims to improve it, together with minor bug fixes in the doc comments for sort*, sort_unstable* and select_nth_unstable*. Is it possible to get these changes into the 1.81 release? It doesn't change behavior and would greatly help when users encounter this panic for the first time, which they may after upgrading to 1.81. Tagging `@orlp`
2024-08-10Stabilize `min_exhaustive_patterns`Nadrieril-0/+2
2024-08-09Add an optimizer hint for the capacity that with_capacity_in returnsBen Kimock-1/+7
2024-08-09Hoist IS_ZST check out of RawVecInner::from_*_inBen Kimock-6/+15
2024-08-09Polymorphize RawVecBen Kimock-212/+369
2024-08-09Fix linkchecker issueLukas Bergdoll-1/+1
2024-08-08Update compiler-builtins version to 0.1.118Guillaume Gomez-1/+1
2024-08-07Rollup merge of #128691 - tgross35:update-builtins, r=AmanieuTrevor Gross-4/+1
Update `compiler-builtins` to 0.1.117 This includes [1] which means we can remove the (nonworking) configuration of `no-f16-f128`. Fixes https://github.com/rust-lang/rust/issues/128401. [1]: https://github.com/rust-lang/compiler-builtins/pull/652 try-job: dist-various-1
2024-08-07Rollup merge of #128261 - clarfonthey:iter-default, r=dtolnayMatthias Krüger-0/+70
impl `Default` for collection iterators that don't already have it There is a pretty strong precedent for implementing `Default` for collection iterators, and this does so for some where this implementation was missed. I don't think this needs a separate ACP (since this precedent already exists, and these feel like they were just missed), however, it *will* need an FCP since these implementations are instantly stable.
2024-08-07alloc: make `to_string_str!` a bit less complexMichael Howell-22/+35
2024-08-06Update `compiler-builtins` to 0.1.117Trevor Gross-4/+1
This includes [1] which means we can remove the (nonworking) configuration of `no-f16-f128`. Fixes https://github.com/rust-lang/rust/issues/128401. [1]: https://github.com/rust-lang/compiler-builtins/pull/652
2024-08-07Rollup merge of #125048 - dingxiangfei2009:stable-deref, r=amanieuMatthias Krüger-2/+91
PinCoerceUnsized trait into core cc ``@Darksonn`` ``@wedsonaf`` ``@ojeda`` This is a PR to introduce a `PinCoerceUnsized` trait in order to make trait impls generated by the proc-macro `#[derive(SmartPointer)]`, proposed by [RFC](https://github.com/rust-lang/rfcs/blob/e17e19ac7ad1c8ccad55d4babfaee1aa107d1da5/text/3621-derive-smart-pointer.md#pincoerceunsized-1), sound. There you may find explanation, justification and discussion about the alternatives. Note that we do not seek stabilization of this `PinCoerceUnsized` trait in the near future. The stabilisation of this trait does not block the eventual stabilization process of the `#[derive(SmartPointer)]` macro. Ideally, use of `DerefPure` is more preferrable except this will actually constitute a breaking change. `PinCoerceUnsized` emerges as a solution to the said soundness hole while avoiding the breaking change. More details on the `DerefPure` option have been described in this [section](https://github.com/rust-lang/rfcs/blob/e17e19ac7ad1c8ccad55d4babfaee1aa107d1da5/text/3621-derive-smart-pointer.md#derefpure) of the RFC linked above. Earlier discussion can be found in this [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/Pin.20and.20soundness.20of.20unsizing.20coercions) and [rust-for-linux thread](https://rust-lang.zulipchat.com/#narrow/stream/425075-rust-for-linux/topic/.23.5Bderive.28SmartPointer.29.5D.20and.20pin.20unsoundness.20rfc.233621). try-job: dist-various-2
2024-08-06alloc: add ToString specialization for `&&str`Michael Howell-8/+35
Fixes #128690
2024-08-05Rollup merge of #128309 - kmicklas:btreeset-cursor, r=AmanieuMatthias Krüger-1/+582
Implement cursors for `BTreeSet` Tracking issue: https://github.com/rust-lang/rust/issues/107540 This is a straightforward wrapping of the map API, except that map's `CursorMut` does not make sense, because there is no value to mutate. Hence, map's `CursorMutKey` is wrapped here as just `CursorMut`, since it's unambiguous for sets and we don't normally speak of "keys". On the other hand, I can see some potential for confusion with `CursorMut` meaning different things in each module. I'm happy to take suggestions to improve that. r? ````@Amanieu````
2024-08-03Apply review comments to PartialOrd sectionLukas Bergdoll-7/+7
2024-08-03Rollup merge of #127586 - zachs18:more-must-use, r=cuviperMatthias Krüger-1/+7
Add `#[must_use]` to some `into_raw*` functions. cc #121287 r? ``@cuviper`` Adds `#[must_use = "losing the pointer will leak memory"]`[^1] to `Box::into_raw(_with_allocator)`, `Vec::into_raw_parts(_with_alloc)`, `String::into_raw_parts`[^2], and `rc::{Rc, Weak}::into_raw_with_allocator` (Rc's normal `into_raw` and all of `Arc`'s `into_raw*`s are already `must_use`). Adds `#[must_use = "losing the raw <resource name may leak resources"]` to `IntoRawFd::into_raw_fd`, `IntoRawSocket::into_raw_socket`, and `IntoRawHandle::into_raw_handle`. [^1]: "*will* leak memory" may be too-strong wording (since `Box`/`Vec`/`String`/`rc::Weak` might not have a backing allocation), but I left it as-is for simplicity and consistency. [^2]: `String::into_raw_parts`'s `must_use` message is changed from the previous (possibly misleading) "`self` will be dropped if the result is not used".
2024-08-01Fix mutability in doc tests for `BTreeSet` cursorsKen Micklas-10/+10