about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-09-28cargo update cargo_updategithub-actions-37/+44
compiler & tools dependencies: Locking 93 packages to latest compatible versions Updating addr2line v0.24.2 -> v0.25.1 Removing android-tzdata v0.1.1 Updating anyhow v1.0.99 -> v1.0.100 Updating backtrace v0.3.75 -> v0.3.76 Updating bitflags v2.9.3 -> v2.9.4 Updating camino v1.1.11 -> v1.2.0 Updating cfg-if v1.0.1 -> v1.0.3 Updating chrono v0.4.41 -> v0.4.42 Updating clap v4.5.45 -> v4.5.48 Updating clap_builder v4.5.44 -> v4.5.48 Updating clap_derive v4.5.45 -> v4.5.47 Updating ctrlc v3.4.7 -> v3.5.0 Updating cxx v1.0.185 -> v1.0.186 Updating cxx-build v1.0.185 -> v1.0.186 Updating cxxbridge-cmd v1.0.185 -> v1.0.186 Updating cxxbridge-flags v1.0.185 -> v1.0.186 Updating cxxbridge-macro v1.0.185 -> v1.0.186 Updating dbus v0.9.7 -> v0.9.9 Adding dispatch v0.2.0 Updating dyn-clone v1.0.19 -> v1.0.20 Updating erased-serde v0.4.6 -> v0.4.8 Updating errno v0.3.13 -> v0.3.14 Updating filetime v0.2.25 -> v0.2.26 Updating form_urlencoded v1.2.1 -> v1.2.2 Updating gimli v0.32.0 -> v0.32.3 Adding hashbrown v0.16.0 Updating humantime v2.2.0 -> v2.3.0 Updating iana-time-zone v0.1.63 -> v0.1.64 Updating idna v1.0.3 -> v1.1.0 Updating indexmap v2.10.0 -> v2.11.4 Updating ipc-channel v0.20.1 -> v0.20.2 Updating jobserver v0.1.33 -> v0.1.34 Updating js-sys v0.3.77 -> v0.3.81 Updating libdbus-sys v0.2.5 -> v0.2.6 Updating libffi v4.1.1 -> v4.1.2 Updating libffi-sys v3.3.2 -> v3.3.3 Updating libloading v0.8.8 -> v0.8.9 Updating libredox v0.1.9 -> v0.1.10 Updating linux-raw-sys v0.9.4 -> v0.11.0 Updating log v0.4.27 -> v0.4.28 Updating matchers v0.1.0 -> v0.2.0 Updating memchr v2.7.5 -> v2.7.6 Updating normpath v1.3.0 -> v1.5.0 Removing nu-ansi-term v0.46.0 Removing overload v0.1.1 Updating percent-encoding v2.3.1 -> v2.3.2 Updating pest v2.8.1 -> v2.8.2 Updating pest_derive v2.8.1 -> v2.8.2 Updating pest_generator v2.8.1 -> v2.8.2 Updating pest_meta v2.8.1 -> v2.8.2 Updating potential_utf v0.1.2 -> v0.1.3 Updating regex v1.11.1 -> v1.11.3 Removing regex-automata v0.1.10 Removing regex-automata v0.4.9 Adding regex-automata v0.4.11 Updating regex-lite v0.1.6 -> v0.1.7 Removing regex-syntax v0.6.29 Removing regex-syntax v0.8.5 Adding regex-syntax v0.8.6 Updating rustix v1.0.8 -> v1.1.2 Updating schannel v0.1.27 -> v0.1.28 Updating semver v1.0.26 -> v1.0.27 Updating serde v1.0.219 -> v1.0.228 Updating serde-untagged v0.1.8 -> v0.1.9 Adding serde_core v1.0.228 Updating serde_derive v1.0.219 -> v1.0.228 Updating serde_json v1.0.142 -> v1.0.145 Updating serde_path_to_error v0.1.17 -> v0.1.20 Updating sysinfo v0.37.0 -> v0.37.1 Updating tempfile v3.20.0 -> v3.23.0 Updating thiserror v2.0.15 -> v2.0.16 Updating thiserror-impl v2.0.15 -> v2.0.16 Updating tinyvec v1.9.0 -> v1.10.0 Updating tracing-subscriber v0.3.18 -> v0.3.20 Updating twox-hash v2.1.1 -> v2.1.2 Updating unicode-ident v1.0.18 -> v1.0.19 Updating url v2.5.4 -> v2.5.7 Updating uuid v1.18.0 -> v1.18.1 Updating wasi v0.14.2+wasi-0.2.4 -> v0.14.7+wasi-0.2.4 Updating wasi-preview1-component-adapter-provider v36.0.1 -> v36.0.2 Adding wasip2 v1.0.1+wasi-0.2.4 Updating wasm-bindgen v0.2.100 -> v0.2.104 Updating wasm-bindgen-backend v0.2.100 -> v0.2.104 Updating wasm-bindgen-macro v0.2.100 -> v0.2.104 Updating wasm-bindgen-macro-support v0.2.100 -> v0.2.104 Updating wasm-bindgen-shared v0.2.100 -> v0.2.104 Updating winapi-util v0.1.9 -> v0.1.11 Removing windows v0.58.0 Updating windows-core v0.58.0 -> v0.62.1 Removing windows-implement v0.58.0 Removing windows-implement v0.60.0 Adding windows-implement v0.60.1 Removing windows-interface v0.58.0 Removing windows-interface v0.59.1 Adding windows-interface v0.59.2 Adding windows-link v0.2.0 Updating windows-result v0.2.0 -> v0.4.0 Updating windows-strings v0.1.0 -> v0.5.0 Adding windows-sys v0.61.1 Updating windows-targets v0.53.3 -> v0.53.4 Updating winnow v0.7.12 -> v0.7.13 Adding wit-bindgen v0.46.0 Removing wit-bindgen-rt v0.39.0 Updating xattr v1.5.1 -> v1.6.1 Updating zerocopy v0.8.26 -> v0.8.27 Updating zerocopy-derive v0.8.26 -> v0.8.27 note: pass `--verbose` to see 33 unchanged dependencies behind latest library dependencies: Locking 19 packages to latest compatible versions Updating addr2line v0.25.0 -> v0.25.1 Updating cfg-if v1.0.1 -> v1.0.3 Updating dlmalloc v0.2.10 -> v0.2.11 Updating gimli v0.32.0 -> v0.32.3 Updating libc v0.2.175 -> v0.2.176 Updating memchr v2.7.5 -> v2.7.6 Updating vex-sdk v0.27.0 -> v0.27.1 Adding windows-link v0.2.0 Updating windows-sys v0.59.0 -> v0.60.2 Updating windows-targets v0.52.6 -> v0.53.4 Updating windows_aarch64_gnullvm v0.52.6 -> v0.53.0 Updating windows_aarch64_msvc v0.52.6 -> v0.53.0 Updating windows_i686_gnu v0.52.6 -> v0.53.0 Updating windows_i686_gnullvm v0.52.6 -> v0.53.0 Updating windows_i686_msvc v0.52.6 -> v0.53.0 Updating windows_x86_64_gnu v0.52.6 -> v0.53.0 Updating windows_x86_64_gnullvm v0.52.6 -> v0.53.0 Updating windows_x86_64_msvc v0.52.6 -> v0.53.0 Updating wit-bindgen v0.45.0 -> v0.45.1 note: pass `--verbose` to see 4 unchanged dependencies behind latest rustbook dependencies: Locking 63 packages to latest compatible versions Updating ammonia v4.1.1 -> v4.1.2 Removing android-tzdata v0.1.1 Updating anyhow v1.0.99 -> v1.0.100 Removing bitflags v1.3.2 Removing bitflags v2.9.2 Adding bitflags v2.9.4 Updating cc v1.2.33 -> v1.2.39 Updating cfg-if v1.0.1 -> v1.0.3 Updating chrono v0.4.41 -> v0.4.42 Updating clap v4.5.45 -> v4.5.48 Updating clap_builder v4.5.44 -> v4.5.48 Updating clap_complete v4.5.57 -> v4.5.58 Updating clap_derive v4.5.45 -> v4.5.47 Updating errno v0.3.13 -> v0.3.14 Adding find-msvc-tools v0.1.2 Updating form_urlencoded v1.2.1 -> v1.2.2 Updating getopts v0.2.23 -> v0.2.24 Updating hashbrown v0.15.5 -> v0.16.0 Updating iana-time-zone v0.1.63 -> v0.1.64 Updating idna v1.0.3 -> v1.1.0 Updating indexmap v2.10.0 -> v2.11.4 Updating js-sys v0.3.77 -> v0.3.81 Updating linux-raw-sys v0.9.4 -> v0.11.0 Updating log v0.4.27 -> v0.4.28 Updating memchr v2.7.5 -> v2.7.6 Updating normpath v1.3.0 -> v1.5.0 Updating opener v0.8.2 -> v0.8.3 Updating percent-encoding v2.3.1 -> v2.3.2 Updating pest v2.8.1 -> v2.8.2 Updating pest_derive v2.8.1 -> v2.8.2 Updating pest_generator v2.8.1 -> v2.8.2 Updating pest_meta v2.8.1 -> v2.8.2 Updating potential_utf v0.1.2 -> v0.1.3 Updating regex v1.11.1 -> v1.11.3 Updating regex-automata v0.4.9 -> v0.4.11 Updating regex-syntax v0.8.5 -> v0.8.6 Updating rustix v1.0.8 -> v1.1.2 Updating semver v1.0.26 -> v1.0.27 Updating serde v1.0.219 -> v1.0.228 Adding serde_core v1.0.228 Updating serde_derive v1.0.219 -> v1.0.228 Updating serde_json v1.0.142 -> v1.0.145 Updating syntect v5.2.0 -> v5.3.0 Updating tempfile v3.20.0 -> v3.23.0 Updating thiserror v2.0.15 -> v2.0.16 Updating thiserror-impl v2.0.15 -> v2.0.16 Updating unicode-ident v1.0.18 -> v1.0.19 Updating url v2.5.4 -> v2.5.7 Updating wasi v0.14.2+wasi-0.2.4 -> v0.14.7+wasi-0.2.4 Adding wasip2 v1.0.1+wasi-0.2.4 Updating wasm-bindgen v0.2.100 -> v0.2.104 Updating wasm-bindgen-backend v0.2.100 -> v0.2.104 Updating wasm-bindgen-macro v0.2.100 -> v0.2.104 Updating wasm-bindgen-macro-support v0.2.100 -> v0.2.104 Updating wasm-bindgen-shared v0.2.100 -> v0.2.104 Updating winapi-util v0.1.9 -> v0.1.11 Updating windows-core v0.61.2 -> v0.62.1 Updating windows-implement v0.60.0 -> v0.60.1 Updating windows-interface v0.59.1 -> v0.59.2 Updating windows-link v0.1.3 -> v0.2.0 Updating windows-result v0.3.4 -> v0.4.0 Updating windows-strings v0.4.2 -> v0.5.0 Updating windows-sys v0.59.0 -> v0.61.1 Updating windows-targets v0.53.3 -> v0.53.4 Updating winnow v0.7.12 -> v0.7.13 Adding wit-bindgen v0.46.0 Removing wit-bindgen-rt v0.39.0 note: pass `--verbose` to see 1 unchanged dependencies behind latest
2025-09-27Remove `cfg(bootstrap)` for `doc_cfg` feature following #141925Guillaume Gomez-71/+23
2025-09-27Fix autodiff feature activationGuillaume Gomez-1/+0
2025-09-27fmtGuillaume Gomez-11/+2
2025-09-27Remove `doc_cfg_hide` featureGuillaume Gomez-3/+4
2025-09-27Strenghten checks for `doc(auto_cfg(show/hide))` attributesGuillaume Gomez-8/+1
2025-09-27Implement RFC 3631Guillaume Gomez-30/+84
2025-09-27Auto merge of #146636 - Mark-Simulacrum:bootstrap-bump, r=jieyouxubors-121/+121
Bump bootstrap compiler to 1.91 beta https://forge.rust-lang.org/release/process.html#default-branch-bootstrap-update-tuesday
2025-09-26Update CURRENT_RUSTC_VERSION post-bumpMark Rousskov-121/+121
2025-09-26Rollup merge of #145113 - petrochenkov:lessfinalize, r=lcnrMatthias Krüger-2/+1
resolve: Do not finalize shadowed bindings I.e. do not mark them as used, or non-speculatively loaded, or similar. Previously they were sometimes finalized during early resolution, causing issues like https://github.com/rust-lang/rust/pull/144793#issuecomment-3168108005.
2025-09-26Auto merge of #147054 - matthiaskrgr:rollup-660g92w, r=matthiaskrgrbors-1/+1
Rollup of 7 pull requests Successful merges: - rust-lang/rust#146283 (Resolve: (Ref)Cell wrappers to deny mutation during spec resolution.) - rust-lang/rust#146453 (Add general arm-linux.md platform doc.) - rust-lang/rust#146991 (const_caller_location to use real Span instead of `DUMMY_SP`) - rust-lang/rust#146994 (Add `clippy::unconditional_recursion` to `./x clippy ci`) - rust-lang/rust#147038 (Rename verbosity functions in bootstrap) - rust-lang/rust#147047 (rustdoc: put the toolbar on the all item index) - rust-lang/rust#147049 (std: fix warning in VEXos stdio module) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-26Rollup merge of #147049 - vexide:vex-std, r=workingjubileeMatthias Krüger-1/+1
std: fix warning in VEXos stdio module Fixes building `std` on the `armv7a-vex-v5` target due to an unnecessarily mutable argument in `Stdin`. This was a stupid oversight on my part towards the end of rust-lang/rust#145973's review process. Missed a warning and had a bad bootstrap config that didn't tell me about it when testing changes.
2025-09-26Auto merge of #145882 - m-ou-se:format-args-extend-1-arg, r=petrochenkovbors-0/+6
Extended temporary argument to format_args!() in all cases Fixes https://github.com/rust-lang/rust/issues/145880 by removing the special case.
2025-09-25std: fix warning in VEXos stdio moduleTropical-1/+1
2025-09-25Auto merge of #147037 - matthiaskrgr:rollup-xtgqzuu, r=matthiaskrgrbors-29/+110
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-25resolve: Do not finalize shadowed bindingsVadim Petrochenkov-2/+1
I.e. do not mark them as used, or non-speculative loaded, or similar. Previously they were sometimes finalized during early resolution, causing issues like https://github.com/rust-lang/rust/pull/144793#issuecomment-3168108005.
2025-09-25Rollup merge of #146924 - cptpiepmatz:doc-nonzero-const-creation, r=joboetMatthias Krüger-0/+12
Add doc for `NonZero*` const creation I ran into trouble using `NonZero*` values because I didn’t see any clear way to create them at compile time. At first I ended up using `NonZero*::new_unchecked` a lot, until I realized that `Option::unwrap` and `Option::expect` are `const` and can be used in a `const` context. With that, you can create non-zero values at compile time safely, without touching `unsafe`. This wasn’t obvious to me and my peers who’ve been using Rust for a while, so I thought adding a note to the docs would make it easier for others to discover. If this should be worded differently or placed in another location, we can do that. I just want to make this more obvious.
2025-09-25Rollup merge of #146859 - cammeresi:btree-alloc-20250920, r=joboetMatthias Krüger-2/+13
BTreeMap: Don't leak allocators when initializing nodes Memory was allocated via `Box::leak` and thence intended to be tracked and deallocated manually, but the allocator was also leaked, not tracked, and never dropped. Now it is dropped immediately. According to my reading of the `Allocator` trait, if a copy of the allocator remains live, then its allocations must remain live. Since the B-tree has a copy of the allocator that will only be dropped after the nodes, it's safe to not store the allocator in each node (which would be a much more intrusive change). Fixes: rust-lang/rust#106203
2025-09-25Rollup merge of #146293 - BenjaminBrienen:try_remove, r=joboetMatthias Krüger-2/+46
feat: non-panicking `Vec::try_remove` `if index < my_vector.len() { Some(my_vector.remove(index)) } else { None }` is annoying to write and non-panicking functions are broadly useful. APC: https://github.com/rust-lang/libs-team/issues/649 Tracking issue: https://github.com/rust-lang/rust/issues/146954
2025-09-25Rollup merge of #141032 - petrosagg:extract-if-ub, r=joboetMatthias Krüger-25/+39
avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if` The implementation of the `Vec::extract_if` iterator violates the safety contract adverized by `slice::from_raw_parts` by always constructing a mutable slice for the entire length of the vector even though that span of memory can contain holes from items already drained. The safety contract of `slice::from_raw_parts` requires that all elements must be properly initialized. As an example we can look at the following code: ```rust let mut v = vec![Box::new(0u64), Box::new(1u64)]; for item in v.extract_if(.., |x| **x == 0) { drop(item); } ``` In the second iteration a `&mut [Box<u64>]` slice of length 2 will be constructed. The first slot of the slice contains the bitpattern of an already deallocated box, which is invalid. This fixes the issue by only creating references to valid items and using pointer manipulation for the rest. I have also taken the liberty to remove the big `unsafe` blocks in place of targetted ones with a SAFETY comment. The approach closely mirrors the implementation of `Vec::retain_mut`. **Note to reviewers:** The diff is easier to follow with whitespace hidden.
2025-09-25add doc for `NonZero*` const creationTim 'Piepmatz' Hesse-0/+12
2025-09-25Auto merge of #147019 - Zalathar:rollup-boxzbmo, r=Zalatharbors-148/+1191
Rollup of 14 pull requests Successful merges: - rust-lang/rust#145067 (RawVecInner: add missing `unsafe` to unsafe fns) - rust-lang/rust#145277 (Do not materialise X in [X; 0] when X is unsizing a const) - rust-lang/rust#145973 (Add `std` support for `armv7a-vex-v5`) - rust-lang/rust#146667 (Add an attribute to check the number of lanes in a SIMD vector after monomorphization) - rust-lang/rust#146735 (unstably constify float mul_add methods) - rust-lang/rust#146737 (f16_f128: enable some more tests in Miri) - rust-lang/rust#146766 (Add attributes for #[global_allocator] functions) - rust-lang/rust#146905 (llvm: update remarks support on LLVM 22) - rust-lang/rust#146982 (Remove erroneous normalization step in `tests/run-make/linker-warning`) - rust-lang/rust#147005 (Small string formatting cleanup) - rust-lang/rust#147007 (Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs`) - rust-lang/rust#147008 (bootstrap.py: Respect build.jobs while building bootstrap tool) - rust-lang/rust#147013 (rustdoc: Fix documentation for `--doctest-build-arg`) - rust-lang/rust#147015 (Use `LLVMDisposeTargetMachine`) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-25Rollup merge of #147007 - LawnGnome:tosocketaddrs-doc, r=tgross35Stuart Cook-0/+2
Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs` Although the examples below this list do imply that there's an impl of `ToSocketAddrs` for `&[SocketAddr]`, it's not actually noted in the list of default implementations.
2025-09-25Rollup merge of #146737 - RalfJung:f16-f128-miri, r=tgross35Stuart Cook-17/+15
f16_f128: enable some more tests in Miri For some reason, a bunch of tests were disabled in Miri that don't use any fancy intrinsics. Let's enable them. I verified this with `./x miri library/core --no-doc -- float`. r? `@tgross35`
2025-09-25Rollup merge of #146735 - Qelxiros:const_mul_add, r=tgross35,RalfJungStuart Cook-94/+59
unstably constify float mul_add methods Tracking issue: rust-lang/rust#146724 r? `@tgross35`
2025-09-25Rollup merge of #145973 - vexide:vex-std, r=tgross35Stuart Cook-1/+992
Add `std` support for `armv7a-vex-v5` This PR adds standard library support for the VEX V5 Brain (`armv7a-vex-v5` target). It is more-or-less an updated version of the library-side work done in rust-lang/rust#131530. This was a joint effort between me, `@lewisfm,` `@max-niederman,` `@Gavin-Niederman` and several other members of the [`vexide` project](https://github.com/vexide/). ## Background VEXos is a fairly unconventional operating system, with user code running in a restricted enviornment with regards to I/O capabilities and whatnot. As such, several OS-dependent APIs are unsupported or have partial support (such as `std::net`, `std::process`, and most of `std::thread`). A more comprehensive list of what does or doesn't work is outlined in the [updated target documentation](https://github.com/vexide/rust/blob/vex-std/src/doc/rustc/src/platform-support/armv7a-vex-v5.md). Despite these limitations, we believe that `libstd` support on this target still has value to users, especially given the popular use of this hardware for educational purposes. For some previous discussion on this matter, see [this comment](https://github.com/rust-lang/rust/pull/131530#issuecomment-2432856841). ## SDK Linkage VEXos doesn't really ship with an official `libc` or POSIX-style platform API (and though it does port newlib, these are stubbed on top of the underlying SDK). Instead, VEX provides their own SDK for calling platform APIs. Their official SDK is kept proprietary (with public headers), though open-source implementations exist. Following the precedent of the `armv6k-nintendo-3ds` team's work in rust-lang/rust#95897, we've opted not to directly link `libstd` to any SDK with the expectation that users will provide their own with one of the following options: - [`vex-sdk-download`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-download), which downloads an official proprietary SDK from VEX using a build script. - [`vex-sdk-jumptable`](https://crates.io/crates/vex-sdk-jumptable), which is a compatible, open-source reimplementation of the SDK using firmware jumps. - [`vex-sdk-pros`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-pros), which uses the [PROS kernel](https://github.com/purduesigbots/pros) as a provider for SDK functions. - Linking their own implementation or stubbing the functions required by libstd. The `vex-sdk` crate used in the VEXos PAL provides `libc`-style FFI bindings for any compatible system library, so any of these options *should* work fine. A functional demo project using `vex-sdk-download` can be found [here](https://github.com/vexide/armv7a-vex-v5-demo/tree/main). ## Future Work This PR implements virtually everything we are currently able to implement given the current capabilities of the platform. The exception to this is file directory enumeration, though the implementation of that is sufficiently [gross enough](https://github.com/vexide/vexide/blob/c6c5bad11e035cf4e51d429dca7e427210185ed4/packages/vexide-core/src/fs/mod.rs#L987) to drive us away from supporting this officially. Additionally, I have a working branch implementing the `panic_unwind` runtime for this target, which is something that would be nice to see in the future, though given the volume of compiler changes i've deemed it out-of-scope for this PR.
2025-09-25Rollup merge of #145067 - btj:patch-3, r=tgross35Stuart Cook-36/+123
RawVecInner: add missing `unsafe` to unsafe fns Some (module-private) functions in `library/alloc/src/raw_vec/mod.rs` are unsafe (i.e. may cause UB when called from safe code) but are not marked `unsafe`. Specifically: - `RawVecInner::grow_exact` causes UB if called with `len` and `additional` arguments such that `len + additional` is less than the current capacity. Indeed, in that case it calls [Allocator::grow](https://doc.rust-lang.org/std/alloc/trait.Allocator.html#method.grow) with a `new_layout` that is smaller than `old_layout`, which violates a safety precondition. - The RawVecInner methods for resizing the buffer cause UB if called with an `elem_layout` different from the one used to initially allocate the buffer, because in that case `Allocator::grow` or `Allocator::shrink` are called with an `old_layout` that does not *fit* the allocated block, which violates a safety precondition. - `RawVecInner::current_memory` might cause UB if called with an `elem_layout` different from the one used to initially allocate the buffer, because the `unchecked_mul` might overflow. - Furthermore, these methods cause UB if called with an `elem_layout` where the size is not a multiple of the alignment. This is because `Layout::repeat` is used (in `layout_array`) to compute the allocation's layout when allocating, which includes padding to ensure alignment of array elements, but simple multiplication is used (in `current_memory`) to compute the old allocation's layout when resizing or deallocating, which would cause the layout used to resize or deallocate to not *fit* the allocated block, which violates a safety precondition. I discovered these issues while performing formal verification of `library/alloc/src/raw_vec/mod.rs` per [Challenge 19](https://model-checking.github.io/verify-rust-std/challenges/0019-rawvec.html) of the [AWS Rust Standard Library Verification Contest](https://aws.amazon.com/blogs/opensource/verify-the-safety-of-the-rust-standard-library/).
2025-09-25Auto merge of #147003 - matthiaskrgr:rollup-b5z9uiz, r=matthiaskrgrbors-35/+66
Rollup of 7 pull requests Successful merges: - rust-lang/rust#146556 (Fix duration_since panic on unix when std is built with integer overflow checks) - rust-lang/rust#146679 (Clarify Display for error should not include source) - rust-lang/rust#146753 (Improve the pretty print of UnstableFeature clause) - rust-lang/rust#146894 (Improve derive suggestion of const param) - rust-lang/rust#146950 (core: simplify `CStr::default()`) - rust-lang/rust#146958 (Fix infinite recursion in Path::eq with String) - rust-lang/rust#146971 (fix ICE in writeback due to bound regions) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-24BTreeMap: Don't leak allocators when initializing nodesSidney Cammeresi-2/+13
Memory was allocated via `Box::leak` and thence intended to be tracked and deallocated manually, but the allocator was also leaked, not tracked, and never dropped. Now it is dropped immediately. According to my reading of the `Allocator` trait, if a copy of the allocator remains live, then its allocations must remain live. Since the B-tree has a copy of the allocator that will only be dropped after the nodes, it's safe to not store the allocator in each node (which would be a much more intrusive change).
2025-09-24Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs`.Adam Harvey-0/+2
Although the examples below this list do imply that there's an impl of `ToSocketAddrs` for `&[SocketAddr]`, it's not actually noted in the list of default implementations.
2025-09-24Rollup merge of #146958 - el-ev:fix_path_string_eq_recurse, r=joboetMatthias Krüger-9/+19
Fix infinite recursion in Path::eq with String - Closes [after beta backport] rust-lang/rust#146940
2025-09-24Rollup merge of #146950 - joboet:cstr_default, r=tgross35Matthias Krüger-8/+3
core: simplify `CStr::default()` Just use a `CStr`-literal...
2025-09-24Rollup merge of #146679 - stepancheg:error-display-source, r=dtolnayMatthias Krüger-1/+7
Clarify Display for error should not include source Fixes rust-lang/rust#145561. r? `@Noratrieb`
2025-09-24Repro duration_since regression from issue 146228Stepan Koltsov-17/+37
2025-09-24unstably constify float mul_add methodsJeremy Smart-94/+59
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-09-24Clarify Display for error should not include sourceStepan Koltsov-1/+7
2025-09-24Rollup merge of #146964 - Ayush1325:close-protocol, r=joboetMatthias Krüger-0/+4
library: std: sys: pal: uefi: Add some comments I seemed to have forgotten that since I am using GET_PROTOCOL attribute for the std usecases, I did not need to close the protocols explicitly. So adding these comments as a note to future self not to waste time on the same thing again.
2025-09-24Rollup merge of #146915 - clarfonthey:safe-intrinsics-2, r=RalfJungMatthias Krüger-20/+14
Make missed precondition-free float intrinsics safe So, in my defence, these were both separated out from the other intrinsics in the file *and* had a different safety comment in the stable versions, so, I didn't notice them before. But, in my offence, the entire reason I did the previous PR was because I was using them for SIMD intrinsic fallbacks, and `fabs` is needed for those too, so, I don't really have an excuse. Extra follow-up to rust-lang/rust#146683. r? ```@RalfJung``` who reviewed the previous one These don't appear to be used anywhere outside of the standard locations, at least.
2025-09-24std: add support for armv7a-vex-v5 targetTropical-1/+992
Co-authored-by: Lewis McClelland <lewis@lewismcclelland.me>
2025-09-24f16_f128: enable some more tests in MiriRalf Jung-17/+15
2025-09-24Fix infinite recursion in Path::eq with StringIris Shi-9/+19
2025-09-24feature: Implement vec_try_removeBenjaminBrienen-2/+46
Vec::try_remove is a non-panicking version of Vec::remove
2025-09-24alloc: simplify `Default` for `Box<CStr>` and `Rc<CStr>`joboet-5/+2
2025-09-24library: std: sys: pal: uefi: Add some commentsAyush Singh-0/+4
I seemed to have forgotten that since I am using GET_PROTOCOL attribute for the std usecases, I did not need to close the protocols explicitly. So adding these comments as a note to future self not to waste time on the same thing again. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-09-24core: simplify `CStr::default()`joboet-3/+1
Just use a `CStr`-literal...
2025-09-23Make missed precondition-free float intrinsics safeltdk-20/+14
2025-09-23Rollup merge of #146904 - peter-lyons-kehl:140368_data_ptr_const_fn, r=AmanieuMatthias Krüger-5/+5
#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn
2025-09-23Rollup merge of #146818 - npmccallum:total_cmp, r=fee1-deadMatthias Krüger-90/+93
constify {float}::total_cmp()
2025-09-23Rollup merge of #146632 - ctz:jbp-adaptor-spelling, r=petrochenkovMatthias Krüger-2/+2
Fix uses of "adaptor" These docs are in en_US, so "adapter" is the correct spelling (and indeed used in the next line.) A second commit comes along for the ride to fix other instances in non-rustdoc comments.
2025-09-23Auto merge of #146317 - saethlin:panic=immediate-abort, r=nnethercotebors-91/+84
Add panic=immediate-abort MCP: https://github.com/rust-lang/compiler-team/issues/909 This adds a new panic strategy, `-Cpanic=immediate-abort`. This panic strategy essentially just codifies use of `-Zbuild-std-features=panic_immediate_abort`. This PR is intended to just set up infrastructure, and while it will change how the compiler is invoked for users of the feature, there should be no other impacts. In many parts of the compiler, `PanicStrategy::ImmediateAbort` behaves just like `PanicStrategy::Abort`, because actually most parts of the compiler just mean to ask "can this unwind?" so I've added a helper function so we can say `sess.panic_strategy().unwinds()`. The panic and unwind strategies have some level of compatibility, which mostly means that we can pre-compile the sysroot with unwinding panics then the sysroot can be linked with aborting panics later. The immediate-abort strategy is all-or-nothing, enforced by `compiler/rustc_metadata/src/dependency_format.rs` and this is tested for in `tests/ui/panic-runtime/`. We could _technically_ be more compatible with the other panic strategies, but immediately-aborting panics primarily exist for users who want to eliminate all the code size responsible for the panic runtime. I'm open to other use cases if people want to present them, but not right now. This PR is already large. `-Cpanic=immediate-abort` sets both `cfg(panic = "immediate-abort")` _and_ `cfg(panic = "abort")`. bjorn3 pointed out that people may be checking for the abort cfg to ask if panics will unwind, and also the sysroot feature this is replacing used to require `-Cpanic=abort` so this seems like a good back-compat step. At least for the moment. Unclear if this is a good idea indefinitely. I can imagine this being confusing. The changes to the standard library attributes are purely mechanical. Apart from that, I removed an `unsafe` we haven't needed for a while since the `abort` intrinsic became safe, and I've added a helpful diagnostic for people trying to use the old feature. To test that `-Cpanic=immediate-abort` conflicts with other panic strategies, I've beefed up the core-stubs infrastructure a bit. There is now a separate attribute to set flags on it. I've added a test that this produces the desired codegen, called `tests/run-make-cargo/panic-immediate-abort-codegen/` and also a separate run-make-cargo test that checks that we can build a binary.