summary refs log tree commit diff
path: root/library/alloc
AgeCommit message (Collapse)AuthorLines
2025-02-17update version placeholdersJosh Stone-2/+2
2025-02-15Rollup merge of #136749 - mzeitlin11:extend-asciichar, r=scottmcmJacob Pratt-0/+26
Implement Extend<AsciiChar> for String Implement `Extend<AsciiChar>` for `String` as suggested in https://github.com/rust-lang/rust/issues/110998#issuecomment-2590122968. Also implements `Extend<&AsciiChar>` since there's an analogous impl for `Extend<&char>`, but happy to remove if not thought useful. r? `@scottmcm` since you requested it, but no pressure to review!
2025-02-14Rollup merge of #136983 - ehuss:misc-2024-prep, r=tgross35Jubilee-40/+40
Prepare standard library for Rust 2024 migration This includes a variety of commits preparing the standard library for migration to Rust 2024. The actual migration is blocked on a few things, so I wanted to get this out of the way in a relatively digestable PR.
2025-02-14Rollup merge of #136976 - jedbrown:jed/doc-boxed-deferred-init, r=tgross35Matthias Krüger-84/+44
alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr In the deferred initialization pattern, the docs were needlessly going through `as_mut_ptr().write()` to initialize, which is unnecessary use of a pointer, needs to be inside an `unsafe` block, and may weaken alias analysis.
2025-02-13alloc: Apply missing_unsafe_on_externEric Huss-1/+1
2025-02-13alloc: Apply unsafe_attr_outside_unsafeEric Huss-2/+2
2025-02-13alloc: Workaround hidden doctest lineEric Huss-1/+1
A small workaround for https://github.com/rust-lang/rust/issues/136899, rustdoc's invalid_rust_codeblocks was not handling this well in 2024. This may be needed when migrating to 2024 when building with stage0.
2025-02-13Auto merge of #134633 - GrigorenkoPV:get_disjoint_mut, r=cuviperbors-2/+2
Stabilize `get_many_mut` as `get_disjoint_mut` Tracking issue: #104642 Closes #104642 FCP completed in https://github.com/rust-lang/rust/issues/104642#issuecomment-2558161073
2025-02-13library: Update rand to 0.9.0Eric Huss-36/+36
2025-02-13alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptrJed Brown-84/+44
In the deferred initialization pattern, the docs were needlessly going through as_mut_ptr().write() to initialize, which is unnecessary use of a pointer, needs to be inside an unsafe block, and may weaken alias analysis.
2025-02-10Rollup merge of #136714 - tgross35:update-builtins, r=tgross35Matthias Krüger-1/+1
Update `compiler-builtins` to 0.1.146 Exposes the error function so we can expose this in the standard library [1]. [1]: https://github.com/rust-lang/compiler-builtins/pull/753
2025-02-10Rollup merge of #136705 - compiler-errors:edition-library, r=jhprattJubilee-5/+5
Some miscellaneous edition-related library tweaks Some library edition tweaks that can be done separately from upgrading the whole standard library to edition 2024 (which is blocked on getting the submodules upgraded, for example)
2025-02-10Rollup merge of #136228 - hkBst:patch-28, r=Mark-SimulacrumJubilee-3/+3
Simplify Rc::as_ptr docs + typo fix
2025-02-09Rollup merge of #135488 - GrigorenkoPV:vec_pop_if, r=jhprattMatthias Krüger-5/+1
Stabilize `vec_pop_if` Tracking issue: #122741 FCP completed in https://github.com/rust-lang/rust/issues/122741#issuecomment-2605116387
2025-02-09Fix pattern matching mode changes and unsafe_op_in_unsafe_fnMichael Goulet-1/+1
2025-02-09Mark extern blocks as unsafeMichael Goulet-4/+4
2025-02-09Auto merge of #136751 - bjorn3:update_rustfmt, r=Mark-Simulacrumbors-121/+152
Update bootstrap compiler and rustfmt The rustfmt version we previously used formats things differently from what the latest nightly rustfmt does. This causes issues for subtrees that get formatted both in-tree and in their own repo. Updating the rustfmt used in-tree solves those issues. Also bumped the bootstrap compiler as the stage0 update command always updates both at the same time.
2025-02-08Rustfmtbjorn3-121/+152
2025-02-08Implement Extend<AsciiChar> for StringMatthew Zeitlin-0/+26
2025-02-08Rollup merge of #136099 - Kijewski:pr-rc-str-default, r=ibraheemdevMatthias Krüger-3/+6
Optimize `Rc::<str>::default()` implementation This PR lets `impl Default for Rc<str>` re-use the implementation for `Rc::<[u8]>::default()`. The previous version only calculted the memory layout at runtime, even though it should be known at compile time, resulting in an additional function call. The same optimization is done for `Rc<CStr>`. Generated byte code: <https://godbolt.org/z/dfq73jsoP>. Resolves <https://github.com/rust-lang/rust/issues/135784>. Cc `@Billy-Sheppard.`
2025-02-07Update `compiler-builtins` to 0.1.146Trevor Gross-1/+1
Exposes the error function so we can expose this in the standard library [1]. [1]: https://github.com/rust-lang/compiler-builtins/pull/753
2025-02-06Remove some unnecessary parens in `assert!` conditionsEsteban Küber-11/+11
While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-02-04Update `compiler-builtins` to 0.1.145Trevor Gross-1/+1
This includes [1] which is required for LLVM 20. [1]: https://github.com/rust-lang/compiler-builtins/pull/752
2025-01-31Update encode_utf16 to mention it is native endianMarijn Schouten-8/+8
2025-01-30Rollup merge of #136215 - btj:patch-1, r=cuviperStuart Cook-2/+2
btree/node.rs: remove incorrect comment from pop_internal_level docs
2025-01-29btree/node.rs: pop_internal_level: does not invalidate other handlesBart Jacobs-0/+3
2025-01-29Simplify Rc::as_ptr docs + typo fixMarijn Schouten-3/+3
2025-01-28btree/node.rs: remove incorrect comment from pop_internal_level docsBart Jacobs-3/+0
2025-01-28Auto merge of #136203 - matthiaskrgr:rollup-1k0f44l, r=matthiaskrgrbors-0/+2
Rollup of 9 pull requests Successful merges: - #135869 (Make docs for AtomicUsize::from_mut platform-independent) - #135892 (-Znext-solver: "normalize" signature before checking it mentions self in `deduce_closure_signature`) - #136055 (Implement MIR const trait stability checks) - #136066 (Pass spans to `perform_locally_in_new_solver`) - #136071 ([Clippy] Add vec_reserve & vecdeque_reserve diagnostic items) - #136124 (Arbitrary self types v2: explain test.) - #136149 (Flip the `rustc-rayon`/`indexmap` dependency order) - #136173 (Update comments and sort target_arch in c_char_definition) - #136178 (Update username in build helper example) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-28Rollup merge of #136071 - wowinter13:clippy-add-diagnostic-items, r=flip1995Matthias Krüger-0/+2
[Clippy] Add vec_reserve & vecdeque_reserve diagnostic items I’m currently working on reviving this lint (https://github.com/rust-lang/rust-clippy/pull/10157), and there was [a comment](https://github.com/rust-lang/rust-clippy/pull/10157#discussion_r1091591057) from ``@flip1995`` regarding the necessity of adding new diagnostic items.
2025-01-28Stabilize `get_many_mut` as `get_disjoint_mut`Pavel Grigorenko-2/+2
* Renames the methods: * `get_many_mut` -> `get_disjoint_mut` * `get_many_unchecked_mut` -> `get_disjoint_unchecked_mut` * Does not rename the feature flag: `get_many_mut` * Marks the feature as stable * Renames some helper stuff: * `GetManyMutError` -> `GetDisjointMutError` * `GetManyMutIndex` -> `GetDisjointMutIndex` * `get_many_mut_helpers` -> `get_disjoint_mut_helpers` * `get_many_check_valid` -> `get_disjoint_check_valid` This only touches slice methods. HashMap's methods and feature gates are not renamed here (nor are they stabilized).
2025-01-28Rollup merge of #135805 - DiuDiu777:master, r=NoratriebMatthias Krüger-2/+5
Add missing allocator safety in alloc crate ### PR Description In the previous PR [#135009](https://github.com/rust-lang/rust/pull/135009), PR [#134496](https://github.com/rust-lang/rust/pull/134496), some incomplete API documentation issues have been fixed. Based on these changes, other inconsistencies related to the allocator have also been identified, including: - `Box::from_non_null` - `Box::from_non_null_in` - `Weak::from_raw`
2025-01-28Rollup merge of #135367 - Urgau:unreach_pub-std-3, r=NoratriebMatthias Krüger-210/+251
Enable `unreachable_pub` lint in `alloc` This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `alloc` crate. Most of changes are in the btree implementation and in tests. *The diff was mostly generated with `./x.py fix --stage 1 library/alloc/ -- --broken-code`, as well as manual edits for code in macros and in tests.* Continuation of #134286 and #135366 r? libs
2025-01-26Optimize `Rc::<str>::default()` implementationRené Kijewski-3/+6
This PR lets `impl Default for Rc<str>` re-use the implementation for `Rc::<[u8]>::default()`. The previous version only calculted the memory layout at runtime, even though it should be known at compile time, resulting in an additional function call. The same optimization is done for `Rc<CStr>`. Generated byte code: <https://godbolt.org/z/dfq73jsoP>. Resolves <https://github.com/rust-lang/rust/issues/135784>.
2025-01-25Rollup merge of #135948 - bjorn3:update_emscripten_std_tests, r=Mark-SimulacrumJacob Pratt-11/+26
Update emscripten std tests This disables a bunch of emscripten tests that test things emscripten doesn't support and re-enables a whole bunch of tests which now work just fine on emscripten. Tested with `EMCC_CFLAGS="-s MAXIMUM_MEMORY=2GB" ./x.py test library/ --target wasm32-unknown-emscripten`.
2025-01-25[Clippy] Add vec_reserve & vecdeque_reserve diagnostic itemswowinter13-0/+2
2025-01-24Rollup merge of #135728 - hkBst:patch-8, r=joboetMatthias Krüger-3/+5
document order of items in iterator from drain fixes #135710
2025-01-25Stabilize `vec_pop_if`Pavel Grigorenko-5/+1
2025-01-24Rollup merge of #135983 - hkBst:patch-13, r=jhprattMatthias Krüger-4/+3
Doc difference between extend and extend_from_slice fixes #97119
2025-01-24Rollup merge of #135956 - GrigorenkoPV:vec_pop_off, r=dtolnayMatthias Krüger-7/+4
Make `Vec::pop_if` a bit more presentable #135488 minus stabilization. As suggested in https://github.com/rust-lang/rust/pull/135488#issuecomment-2608108210. r? tgross35
2025-01-24Doc difference between extend and extend_from_sliceMarijn Schouten-4/+3
fixes #97119
2025-01-24Remove a bunch of emscripten test ignoresbjorn3-10/+0
They are either outdated as emscripten now supports i128 or they are subsumed by #[cfg_attr(not(panic = "unwind"), ignore]
2025-01-24Fix testing of the standard library with Emscriptenbjorn3-1/+26
This does need EMCC_CFLAGS="-s MAXIMUM_MEMORY=2GB" avoid several OOMs.
2025-01-24Rollup merge of #135890 - GrigorenkoPV:deque-pop-if, r=thomccMatthias Krüger-0/+86
Implement `VecDeque::pop_front_if` & `VecDeque::pop_back_if` Tracking issue: #135889
2025-01-24Make `Vec::pop_if` a bit more presentablePavel Grigorenko-7/+4
2025-01-23Rollup merge of #135073 - joshtriplett:bstr, r=BurntSushiMatthias Krüger-0/+706
Implement `ByteStr` and `ByteString` types Approved ACP: https://github.com/rust-lang/libs-team/issues/502 Tracking issue: https://github.com/rust-lang/rust/issues/134915 These types represent human-readable strings that are conventionally, but not always, UTF-8. The `Debug` impl prints non-UTF-8 bytes using escape sequences, and the `Display` impl uses the Unicode replacement character. This is a minimal implementation of these types and associated trait impls. It does not add any helper methods to other types such as `[u8]` or `Vec<u8>`. I've omitted a few implementations of `AsRef`, `AsMut`, and `Borrow`, when those would be the second implementation for a type (counting the `T` impl), to avoid potential inference failures. We can attempt to add more impls later in standalone commits, and run them through crater. In addition to the `bstr` feature, I've added a `bstr_internals` feature for APIs provided by `core` for use by `alloc` but not currently intended for stabilization. This API and its implementation are based *heavily* on the `bstr` crate by Andrew Gallant (`@BurntSushi).` r? `@BurntSushi`
2025-01-22Implement `VecDeque::pop_front_if` & `VecDeque::pop_back_if`Pavel Grigorenko-0/+86
2025-01-22Remove erroneous `unsafe` in `BTreeSet::upper_bound_mut`Pavel Grigorenko-4/+4
2025-01-22Add doc aliases for BStr and BStringJosh Triplett-0/+1
2025-01-21add missing allocator safety in alloc crateLemonJ-2/+5