about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-10-02Rollup merge of #147227 - edwloef:box_take, r=joboetMatthias Krüger-0/+31
implement `Box::take` Tracking issue: https://github.com/rust-lang/rust/issues/147212 I'm not entirely sure about the wording of the doc comment, if anyone has any suggestions that'd be great :)
2025-10-02Rollup merge of #146281 - Jules-Bertholet:static-align-thread-local, ↵Matthias Krüger-72/+410
r=Mark-Simulacrum Support `#[rustc_align_static]` inside `thread_local!` Tracking issue: rust-lang/rust#146177 ```rust thread_local! { #[rustc_align_static(64)] static SO_ALIGNED: u64 = const { 0 }; } ``` This increases the amount of recursion the macro performs (once per attribute in addition to the previous once per item), making it easier to hit the recursion limit. I’ve added workarounds to limit the impact in the case of long doc comments, but this still needs a crater run just in case. r? libs ``@rustbot`` label A-attributes A-macros A-thread-locals F-static_align T-libs
2025-10-01Auto merge of #147235 - matthiaskrgr:rollup-a0es1x9, r=matthiaskrgrbors-47/+33
Rollup of 8 pull requests Successful merges: - rust-lang/rust#146593 (Allow specifying multiple bounds for same associated item, except in trait objects) - rust-lang/rust#147177 ([DebugInfo] Fix MSVC tuple child creation) - rust-lang/rust#147195 (iter repeat: add tests for new count and last behavior) - rust-lang/rust#147202 (Swap order of `resolve_coroutine_interiors` and `handle_opaque_type_uses`) - rust-lang/rust#147204 (Refactor ArrayWindows to use a slice) - rust-lang/rust#147219 (Add proper error handling for closure in impl) - rust-lang/rust#147226 (include `outer_inclusive_binder` of pattern types) - rust-lang/rust#147230 (Fix typo in 'unfulfilled_lint_expectation' to plural) r? `@ghost` `@rustbot` modify labels: rollup
2025-10-01Rollup merge of #147204 - camsteffen:array-windows-ref, r=joboetMatthias Krüger-47/+22
Refactor ArrayWindows to use a slice [Tracking issue](https://github.com/rust-lang/rust/issues/75027)
2025-10-01Rollup merge of #147195 - hkBst:repeat-3, r=Mark-SimulacrumMatthias Krüger-0/+11
iter repeat: add tests for new count and last behavior Tests for https://github.com/rust-lang/rust/pull/146410
2025-10-01Fix memory leak in `os` implJules Bertholet-31/+72
2025-10-01implement `Box::take`edwloef-0/+31
2025-10-01Change ArrayWindows to use a sliceCameron Steffen-47/+22
2025-10-01Rollup merge of #147213 - ivmarkov:fix-hostname-espidf, r=joboetStuart Cook-1/+1
Fix broken STD build for ESP-IDF PRs rust-lang/rust#147162 and rust-lang/rust#146937 did [broke](https://github.com/esp-rs/esp-idf-sys/actions/runs/18151791720/job/51663969786) the STD build for `target_os = "espidf"` because that target [does not have neither a `gethostname`, not a `libc::_SC_HOST_NAME_MAX` by default](https://github.com/espressif/esp-idf/issues/14849). While there is a [3rd party component for this syscall](https://components.espressif.com/components/espressif/sock_utils/versions/0.2.2/readme) in the ESP-IDF component registry, I don't think we should use it, because it does not come with ESP-IDF by default. Therefore, the one-liner fix just re-routes ESP-IDF into the `unsupported` branch.
2025-10-01Fix broken STD build for ESP-IDFivmarkov-1/+1
2025-10-01Auto merge of #147198 - matthiaskrgr:rollup-b0ryvvu, r=matthiaskrgrbors-3/+25
Rollup of 6 pull requests Successful merges: - rust-lang/rust#143069 (Add fast-path for accessing the current thread id) - rust-lang/rust#146518 (Improve the documentation around `ZERO_AR_DATE`) - rust-lang/rust#146596 (Add a dummy codegen backend) - rust-lang/rust#146617 (Don’t suggest foreign `doc(hidden)` types in "the following other types implement trait" diagnostics) - rust-lang/rust#146635 (cg_llvm: Stop using `as_c_char_ptr` for coverage-related bindings) - rust-lang/rust#147184 (Fix the bevy implied bounds hack for the next solver) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-30Add fast-path for accessing the current thread idJosh Simmons-3/+25
Accessing the thread id is often used in profiling and debugging, as well as some approaches for sound single-threaded access to data. Currently the only way to access the thread id is by first obtaining a handle to the current thread. While this is not exactly slow, it does require an atomic inc-ref and dec-ref operation, as well as the injection of `Thread`'s drop code into the caller. This publicly exposes the existing fast-path for accessing the current thread id.
2025-09-30Rollup merge of #147166 - cyrgani:proc-macro-cleanup-1, r=petrochenkovMatthias Krüger-54/+14
several small `proc_macro` cleanups
2025-09-30Rollup merge of #146886 - taiki-e:rc-inner-align, r=Mark-SimulacrumMatthias Krüger-8/+12
Add repr(align(2)) to RcInner and ArcInner `Rc` currently assumes that `RcInner` has at least 2-byte alignment, but on AVR, `usize` has 1-byte alignment (this is because the AVR has 1-byte register sizes, so having 2-byte alignment is generally useless), breaking this assumption. https://github.com/rust-lang/rust/blob/9f32ccf35fb877270bc44a86a126440f04d676d0/library/alloc/src/rc.rs#L3005-L3008 This PR adds `repr(align(2))` to force `RcInner` to always have at least 2-byte alignment. Note that `ArcInner` doesn't need `repr(align(2))` because atomic types have the alignment same as its size. This PR adds a comment about this.
2025-09-30Rollup merge of #142506 - clarfonthey:path-trailing-sep, r=joboetMatthias Krüger-4/+221
Add `Path::has_trailing_sep` and related methods Implements rust-lang/libs-team#335. Tracking issue: rust-lang/rust#142503 Notable differences from ACP: * `trim_trailing_sep` was added to `Path` since it felt reasonable to ensure that the inverse operation was available. * Per suggestion of `@kennytm,` added `push_trailing_sep` and `pop_trailing_sep` to `PathBuf` in addition to `set_trailing_sep`. This also updates some of the docs on various `Path` methods to use the term "trailing separator" instead of "trailing slash" for consistency.
2025-09-30iter repeat: add tests for new count and last behaviorMarijn Schouten-0/+11
2025-09-30Add repr(align(2)) to RcInner and ArcInnerTaiki Endo-8/+12
2025-09-30explicitly implement `!Send` and `!Sync`cyrgani-31/+12
2025-09-30remove unused `#![feature(stmt_expr_attributes)]`cyrgani-1/+0
2025-09-29remove `reverse_{encode, decode}!`cyrgani-22/+2
2025-09-29Rollup merge of #146937 - joboet:gethostname, r=Mark-SimulacrumMatthias Krüger-78/+224
std: implement `hostname` Resolves https://github.com/rust-lang/libs-team/issues/330 Tracking issue: https://github.com/rust-lang/rust/issues/135142 This is based on rust-lang/rust#135141, but I've reimplemented the UNIX version, which now: * uses `sysconf(_SC_HOST_NAME_MAX)` as an initial buffer length * returns `OutOfMemory` if the `Vec` allocation fails * retries the operation if it detects that the name returned by `gethostname` was truncated Additionally, as part of the rebase, I had to move some WinSock abstractions (initialisation and error access) to `sys::pal` so that they can be accessed from `sys::net::hostname`. CC ``@orowith2os`` (and thank you for your work!)
2025-09-29Rollup merge of #147101 - yotamofek:pr/iter-eq-and-eq-by, r=jdonszelmannStuart Cook-1/+1
Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library Now that rust-lang/rust#137122 has landed, we can replace stuff that looks like: ```rust let a: &[T]; let b: &[T]; let eq = a.len() == b.len() && a.iter().zip(b).all(|(a,b)| a == b) ``` with the much simpler `a.iter().eq(b)`, without losing the perf benefit of the different-length-fast-path. Also dogfooded `Iterator::eq_by` (cc rust-lang/rust#64295 ) while I'm at it. First commit (4d1b6fad230f8a5ccceccc7562eadc4ea50059da) should be very straightforward to review, second one (049a4606cb3906787aedf508ee8eea09c2bb3b9a) is slightly more creative, but IMHO a nice cleanup.
2025-09-29std: implement `hostname`joboet-1/+140
2025-09-29Auto merge of #147140 - Zalathar:rollup-rtnqek7, r=Zalatharbors-1/+2
Rollup of 7 pull requests Successful merges: - rust-lang/rust#133477 (Detect tuple structs that are unconstructable due to re-export) - rust-lang/rust#146929 (compiletest: Remove old-output-capture and become a stage0 bootstrap tool) - rust-lang/rust#146979 (constify Default on Nanoseconds) - rust-lang/rust#147092 (Do not compute optimized MIR if code does not type-check.) - rust-lang/rust#147112 (all 48 keywords in just 300 characters) - rust-lang/rust#147122 (Fix some crash-test directives) - rust-lang/rust#147127 (Add a leading dash to linker plugin arguments in the gcc codegen) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-29Use `Iterator::eq` and (dogfood) `eq_by` in compiler and libraryYotam Ofek-1/+1
2025-09-29Rollup merge of #146979 - npmccallum:nanosecs, r=Mark-SimulacrumStuart Cook-1/+2
constify Default on Nanoseconds
2025-09-29Auto merge of #147090 - Noratrieb:immediate-abort-stack-overflow, r=joboetbors-2/+13
Skip stack overflow handler for panic=immediate-abort std installs guard pages and a signal handler to ensure that stackoverflows 1) terminate abruptly and 2) print an nice message. Even for panic=immediate-abort, 1) is desirable, we don't want silent data corruption there. But 2) is completely unnecessary, as users deliberately *don't* want nice messages, they want minimum binary size. Therefore, skip the entire guard signal handler setup, which saves a lot of bytes. I tested this with a hello world binary using fat LTO, build-std, panic=immediate-abort, opt-level=s, strip=debuginfo. `size` reports significant savings: ``` text data bss dec hex filename 15252 1032 104 16388 4004 tiny-before 6881 964 48 7893 1ed5 tiny-after2 ``` `nm -U` goes from 71 to 56, getting rid of a bunch of stack overflow related symbols. The disk size goes from `31k` to `24k`. The impact on the error message is minimal, as the message was already missing. before: ``` fish: Job 1, './tiny-so-before' terminated by signal SIGABRT (Abort) ``` after: ``` fish: Job 1, './tiny-so-after' terminated by signal SIGSEGV (Address boundary error) ``` I didn't test the Windows part, but it likely also has savings.
2025-09-28Rollup merge of #146675 - Jules-Bertholet:sync-nonexclusive, r=Mark-SimulacrumMatthias Krüger-10/+104
Allow shared access to `Exclusive<T>` when `T: Sync` Addresses libs-api request in https://github.com/rust-lang/rust/issues/98407#issuecomment-3299348713. Adds the following trait impls to `Exclusive<T>`, all bounded on `T: Sync`: - `AsRef<T>` - `Clone` - `Copy` - `PartialEq` - `StructuralPartialEq` - `Eq` - `Hash` - `PartialOrd` - `Ord` - `Fn` ``@rustbot`` label T-libs-api
2025-09-28Rollup merge of #140482 - devnexen:tcp_deferaccept_toduration, r=joboetMatthias Krüger-17/+27
std::net: update tcp deferaccept delay type to Duration. See comment [here](https://github.com/rust-lang/rust/issues/119639#issuecomment-2839330337).
2025-09-28Rollup merge of #147110 - SebastianSpeitel:patch-1, r=saethlinMatthias Krüger-1/+1
Fix typo Noticed this when looking at the source on doc.rust-lang.org
2025-09-28Rollup merge of #147095 - fmease:libprivrepr, r=dtolnayMatthias Krüger-7/+7
Library: Remove remaining private `#[repr]` workarounds With https://github.com/rust-lang/rust/pull/116882 finally merged, gating these `repr`s behind cfg `not(doc)` is no longer necessary to achieve a private repr. Follow up to https://github.com/rust-lang/rust/pull/128046 (that was enabled via https://github.com/rust-lang/rust/pull/115439). With that, https://github.com/rust-lang/rust/pull/116743 is now fully realized at long last. cc ``@dtolnay``
2025-09-28Rollup merge of #147093 - jackpot51:redox-path, r=bjorn3Matthias Krüger-1/+1
redox: switch to colon as path separator We recently changed this in order to better comply with assumptions about Unix-like systems. The current PATH is set to `/usr/bin` with no separators in order to ease the transition.
2025-09-28Rollup merge of #147082 - danielverkamp:fmt-alternate-octal-binary-mixup, ↵Matthias Krüger-2/+2
r=Noratrieb formatting_options: fix alternate docs 0b/0o mixup The descriptions of the alternate forms of Octal and Binary were swapped in the doc comment for FormattingOptions::alternate().
2025-09-28Rollup merge of #146788 - sysrex:146756/discord_invite, r=workingjubileeMatthias Krüger-2/+2
chore: removes deprecated discord. This PR just changes the wording of the contributing document to remove the deprecated Discord. Fixes https://github.com/rust-lang/rust/issues/146756.
2025-09-28Auto merge of #147042 - Noratrieb:untrack-caller-vec, r=tgross35bors-121/+0
Remove most `#[track_caller]` from allocating Vec methods They cause significant binary size overhead while contributing little value. closes rust-lang/rust#146963, see that issue for more details.
2025-09-28Fix typoSebastian Speitel-1/+1
2025-09-27Hoist non-platform-specific code out of `thread_local_inner!`Jules Bertholet-16/+6
2025-09-27fix build for androidDavid Carlier-0/+1
2025-09-27Rollup merge of #147076 - joshuarayton:more-float-constants-issue, r=tgross35Matthias Krüger-24/+24
update issue number for more_float_constants Update issue number from https://github.com/rust-lang/rust/issues/103883 to https://github.com/rust-lang/rust/issues/146939 r? ``@tgross35``
2025-09-27Rollup merge of #146037 - aapoalas:reborrow-lang-experiment, r=tmandryMatthias Krüger-8/+19
Introduce CoerceShared lang item and trait, and basic Reborrow tests Part of rust-lang/rust#145612: This introduces the `CoerceShared` trait which is the `Reborrow` equivalent of a `&mut T` -> `&T` coercion. The trait has a `Target` GAT which makes this (currently) unique in the `core/src/marker.rs`; I'm not sure if this can be considered problematic. Maybe this is not the way such things should be done at the marker trait level? Or maybe it is fine. Improtantly, this PR introduces a battery of basic `Reborrow` and `CoerceShared` tests. These test the very basics of the feature; custom marker types intended to have exclusive semantics (`Custom<'a>(PhantomData<&'a mut ()>)`), custom exclusive reference wrappers, and standard library exclusive reference wrappers (`Pin<&mut T>` and `Option<&mut T>`). None of these of course work since the implementation for `Reborrow` and `CoerceShared` is entirely missing, but this is the first step towards making these work. Future PRs will introduce more tests, such as "recursive" reborrowing (ie. reborrowing structs that contain multiple reborrowable fields) and checks around the lifetime semantics of reborrowing ie. that a reborrow produces a new type with the same lifetime as the original.
2025-09-27Library: Remove remaining private `#[repr]` workaroundsLeón Orell Valerian Liehr-7/+7
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2025-09-27redox: switch to colon as path separatorJeremy Soller-1/+1
2025-09-27Skip stack overflow handler for panic=immediate-abortNoratrieb-2/+13
std installs guard pages and a signal handler to ensure that stackoverflows 1) terminate abruptly and 2) print an nice message. Even for panic=immediate-abort, 1) is desirable, we don't want silent data corruption there. But 2) is completely unnecessary, as users deliberately *don't* want nice messages, they want minimum binary size. Therefore, skip the entire guard signal handler setup, which saves a lot of bytes. I tested this with a hello world binary using fat LTO, build-std, panic=immediate-abort, opt-level=s, strip=debuginfo. `size` reports significant savings: ``` text data bss dec hex filename 15252 1032 104 16388 4004 tiny-before 6881 964 48 7893 1ed5 tiny-after2 ``` `nm -U` goes from 71 to 56, getting rid of a bunch of stack overflow related symbols. The disk size goes from `31k` to `24k`. The impact on the error message is minimal, as the message was already missing. before: ``` fish: Job 1, './tiny-so-before' terminated by signal SIGABRT (Abort) ``` after: ``` fish: Job 1, './tiny-so-after' terminated by signal SIGSEGV (Address boundary error) ```
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