Rollup of 7 pull requests#158919
Closed
JonathanBrouwer wants to merge 35 commits into
Closed
Conversation
I define the concept of "equivalent allocators", in order to be able
to talk about cloning allocators, and to give commonsense guarantees
about stdlib `Allocator` impls.
I define the concept of "invalidating a memory block" in order to be
able to talk about users not being allowed to use a block of allocated
memory after its allocator is "gone".
An `Allocator` implementation is now allowed to invalidate its
allocations when the allocator is mutated or when a lifetime in the
allocator type expires.
Mutation of an `Allocator` should sensibly be allowed to invalidate its
allocations. For example, the `bumpalo` crates has a `Bump::reset`
method that takes `&mut self` and invalidates all past allocations.
Accesses via `&` still must not invalidate past allocations since,
for example, `Box` provides `&` access to the allocator.
I still had the "allocator destructor" clause as a separate clause from
the `&mut` clause, to avoid questions about whether drop glue of types
that don't implement `Drop` but have fields that implement `Drop` counts
as creating a `&mut` to the whole thing.
The "lifetime expiry" clause closes a hole/ambiguity on when an
allocator is considered to be "dropped" if it does not have a
destructor. Additionally, this clause matches what is required for
`Box::into_pin` and `{Rc, Arc}::pin` to be sound. (Those methods have an
`A: 'static` bound to prevent allocating via a `&MyAllocator` and then
running `MyAllocator`'s destructor.)
This change prevents our lints from returning a span with stuff in it that isn't actually part of the doc comment. When that happens, it returns `None` instead.
It requires an allocation, and doesn't seem to help in practice. Fixes a nit found during review.
Co-authored-by: binarycat <binarycat@envs.net>
Co-authored-by: binarycat <binarycat@envs.net>
Co-authored-by: binarycat <binarycat@envs.net>
The docs stated that try_with will return an AccessError when the key has been destroyed. This is not guaranteed: on some platforms, TLS slots can be re-initialized during destruction, so the destroyed state cannot always be observed. Change 'will' to 'may' to accurately reflect the best-effort nature of the check.
…ure HRTB annotation
Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
1) setsid/setpgrp: check child's group process ID Linux [1], FreeBSD [2] and the Open Group [3] manuals for both setsid and setpgrp state that the calling process will be assigned a process group ID that matches its process ID so check that's the case in the test by calling getpgid on the child process ID. on QNX8 (as of GA8.0.2) libc::kill(pgid) appears unable to terminate the child process so skip that check on that target as it's behavior that libstd provides no API for [1]: https://man7.org/linux/man-pages/man2/setsid.2.html [2]: https://man.freebsd.org/cgi/man.cgi?query=setsid&sektion=2 [3]: https://pubs.opengroup.org/onlinepubs/000095399/functions/setsid.html 2) fix handling of sockaddr_un.len on QNX also extend the existing tests to exercise the getsockname(2) and getpeername(2) paths with both named and unnamed Unix sockets 3) Additional fixes library/std after earlier PR renamed some targets 4) Replace more instances of "QNX Neutrino / QNX OS" with "QNX SDP" and fix up some documentation URLs 5) Tests ignored on target_os = "nto" should also be ignored on target_os = "qnx". 6) Simplify nto-qnx.md documentation cc-rs now knows about QNX so the environment isn't required
Enable Enzyme on x86_64-apple Enable Enzyme for x86_64-apple similar PR: rust-lang#157240 r? @ZuseZ4
…name, r=lolbinarycat rustdoc: do not include extra stuff in span This change prevents our lints from returning a span with stuff in it that isn't actually part of the doc comment. When that happens, it returns `None` instead. Fixes rust-lang/rust-clippy#16169, since the bug was reported against the `clippy::doc_paragraphs_missing_punctuation` lint but is actually a bug in `source_span_for_markdown_range_inner`.
Fixes for QNX SDP 8 This PR contains libstd fixes so libstd can be build for QNX SDP 8. It requires patches to libc-0.2 and cc-rs. The cc-rs patch [was merged]([rust-lang/cc-rs#1775](rust-lang/cc-rs#1775)) already. I have a patch for libc-1.0 [here](rust-lang/libc#5241) which will need backporting to libc-0.2 once merged. With these in place, I was able to remotely `test tests/ui library/std library/alloc library/core` for `x86_64-pc-qnx` using a remote-test-server running on QNX SDP 8.0's QEMU BSP image. The only tests that failed were the two `tests/ui/codegen/huge-stacks.rs` tests, and I did not have enough RAM to run them.
…-return, r=aapoalas Clarify that `LocalKey::try_with` may return `AccessError` The docs for `LocalKey::try_with` state that the function *will* return an `AccessError` when the key has been destroyed. That's not actually guaranteed: - `LocalKey::with` uses `try_with` internally and its docs explicitly acknowledge that it does not always panic when the destructor has run. If `try_with` really did detect every destroyed thread-local, `with` could always panic. - The top-level `LocalKey` docs already note: "On all platforms it's possible for TLS to re-initialize other TLS slots during destruction." Change *will* to *may* to accurately reflect the best-effort nature of the destroyed-key check. Closes rust-lang#157889 @rustbot label +A-docs
…e, r=Amanieu Rewrite safety requirements for `Allocator` impls This PR supersedes rust-lang#156544. cc rust-lang#157428, rust-lang#156920 cc @nia-e r? @Amanieu (reviewer of rust-lang#156544) I define the concept of "equivalent allocators", in order to be able to talk about cloning allocators, and to give commonsense guarantees about stdlib `Allocator` impls. I define the concept of "invalidating a memory block" in order to be able to talk about users not being allowed to use a block of allocated memory after its allocator is "gone". An `Allocator` implementation is now allowed to invalidate its allocations when the allocator is mutated or when a lifetime in the allocator type expires. Mutation of an `Allocator` should sensibly be allowed to invalidate its allocations. For example, the `bumpalo` crates has a `Bump::reset` method that takes `&mut self` and invalidates all past allocations. Accesses via `&` still must not invalidate past allocations since, for example, `Box` provides `&` access to the allocator. I still had the "allocator destructor" clause as a separate clause from the `&mut` clause, to avoid questions about whether drop glue of types that don't implement `Drop` but have fields that implement `Drop` counts as creating a `&mut` to the whole thing. The "lifetime expiry" clause closes a hole/ambiguity on when an allocator is considered to be "dropped" if it does not have a destructor. Additionally, this clause matches what is required for `Box::into_pin` and `{Rc, Arc}::pin` to be sound. (Those methods have an `A: 'static` bound to prevent allocating via a `&MyAllocator` and then running `MyAllocator`'s destructor.)
… r=mejrs diagnostics: suggest type annotation for closure params on HRTB FnOnce mismatch Fixes rust-lang#158393 ## Problem When a closure passed to a function requiring `for<'a> FnOnce(&'a mut [u8])` has unannotated parameters (e.g. `|buf|`), the compiler emits the confusing error: ```text implementation of `FnOnce` is not general enough ``` without explaining how to fix it. In many cases, simply adding an explicit type annotation to the closure parameter (e.g. `|buf: &mut [u8]|`) resolves the lifetime ambiguity, but the compiler does not currently provide any guidance. ## What This PR adds a diagnostic suggestion in `placeholder_error.rs` that detects when: - the mismatched trait is an Fn-trait (`FnOnce`, `FnMut`, or `Fn`) - the self type is a local closure - one or more closure parameters do not have explicit type annotations When these conditions are met, the compiler now emits the following help message: ```text help: consider adding an explicit type annotation to the closure parameter to resolve the lifetime ambiguity | | let outer_closure = |buf: &mut [u8]| { | +++++++++++ ``` ## Testing A UI test has been added covering the exact reproduction case from the reported issue.
…ice, r=mejrs Avoid final override ICE for RPITIT associated types Fixes rust-lang#158824 `check_overriding_final_trait_item` was running for every associated item in an impl, including the synthetic anonymous associated type generated for RPITIT.
Contributor
Author
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 7, 2026
Rollup of 7 pull requests try-job: dist-various-1 try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple try-job: x86_64-mingw-1 try-job: i686-msvc-2
Contributor
|
This pull request was unapproved due to being closed. |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
💔 Test for f22e05f failed: CI. Failed job:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
LocalKey::try_withmay returnAccessError#158760 (Clarify thatLocalKey::try_withmay returnAccessError)Allocatorimpls #157801 (Rewrite safety requirements forAllocatorimpls)r? @ghost
Create a similar rollup