Skip to content

Rollup of 7 pull requests#158919

Closed
JonathanBrouwer wants to merge 35 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-VeC7Sqe
Closed

Rollup of 7 pull requests#158919
JonathanBrouwer wants to merge 35 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-VeC7Sqe

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

theemathas and others added 30 commits June 12, 2026 19:23
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.
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.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jul 7, 2026
@rustbot rustbot added A-CI Area: Our Github Actions CI A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 7, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1,i686-msvc-2

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit f2fdef8 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 7, 2026
@rust-bors

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
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 7, 2026
@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved due to being closed.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-apple failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 Documenting rustc_mir_build v0.0.0 (/Users/runner/work/rust/rust/compiler/rustc_mir_build)
warning: redundant explicit link target
    --> compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:2373:5
     |
2373 |     /// Lower a [`hir::ConstArg`] to a (type-level) [`ty::Const`](Const).
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ explicit target `Const` is redundant because label `ty::Const` resolves to same destination
     |
     = note: when a link's destination is not specified,
             the label is used to resolve intra-doc links
     = note: `#[warn(rustdoc::redundant_explicit_links)]` on by default

error: `rustc_hir_analysis` (lib doc) generated 1 warning
error: warnings are denied by `build.warnings` configuration
warning: build failed, waiting for other jobs to finish...
Command `/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage0/bin/cargo doc --target aarch64-apple-darwin -Zbinary-dep-depinfo -j 3 -Zroot-dir=/Users/runner/work/rust/rust --locked --color=always --profile=release --features 'jemalloc llvm rustc' --manifest-path /Users/runner/work/rust/rust/compiler/rustc/Cargo.toml -Zskip-rustdoc-fingerprint --no-deps -Zrustdoc-map -p rustc-main -p rustc_abi -p rustc_arena -p rustc_ast -p rustc_ast_ir -p rustc_ast_lowering -p rustc_ast_passes -p rustc_ast_pretty -p rustc_attr_parsing -p rustc_baked_icu_data -p rustc_borrowck -p rustc_builtin_macros -p rustc_codegen_llvm -p rustc_codegen_ssa -p rustc_const_eval -p rustc_data_structures -p rustc_driver -p rustc_driver_impl -p rustc_error_codes -p rustc_error_messages -p rustc_errors -p rustc_expand -p rustc_feature -p rustc_fs_util -p rustc_graphviz -p rustc_hashes -p rustc_hir -p rustc_hir_analysis -p rustc_hir_id -p rustc_hir_pretty -p rustc_hir_typeck -p rustc_incremental -p rustc_index -p rustc_index_macros -p rustc_infer -p rustc_interface -p rustc_lexer -p rustc_lint -p rustc_lint_defs -p rustc_llvm -p rustc_log -p rustc_macros -p rustc_metadata -p rustc_middle -p rustc_mir_build -p rustc_mir_dataflow -p rustc_mir_transform -p rustc_monomorphize -p rustc_next_trait_solver -p rustc_parse -p rustc_parse_format -p rustc_passes -p rustc_pattern_analysis -p rustc_privacy -p rustc_proc_macro -p rustc_public -p rustc_public_bridge -p rustc_query_impl -p rustc_resolve -p rustc_sanitizers -p rustc_serialize -p rustc_session -p rustc_span -p rustc_symbol_mangling -p rustc_target -p rustc_thread_pool -p rustc_trait_selection -p rustc_traits -p rustc_transmute -p rustc_ty_utils -p rustc_type_ir -p rustc_type_ir_macros -p rustc_windows_rc [workdir=/Users/runner/work/rust/rust]` failed with exit code 101
Created at: src/bootstrap/src/core/build_steps/doc.rs:930:25
Executed at: src/bootstrap/src/core/build_steps/doc.rs:991:26

--- BACKTRACE vvv
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1: std::backtrace_rs::backtrace::trace_unsynchronized::<<std::backtrace::Backtrace>::create::{closure#0}>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2: <std::backtrace::Backtrace>::create
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/backtrace.rs:331:13
   3: <bootstrap::utils::exec::DeferredCommand>::finish_process
             at ./src/bootstrap/src/utils/exec.rs:939:17
   4: <bootstrap::utils::exec::DeferredCommand>::wait_for_output::<&bootstrap::utils::exec::ExecutionContext>
             at ./src/bootstrap/src/utils/exec.rs:831:21
   5: <bootstrap::utils::exec::ExecutionContext>::run
             at ./src/bootstrap/src/utils/exec.rs:741:45
   6: <bootstrap::utils::exec::BootstrapCommand>::run::<&bootstrap::core::builder::Builder>
             at ./src/bootstrap/src/utils/exec.rs:339:27
   7: <bootstrap::core::build_steps::doc::Rustc as bootstrap::core::builder::Step>::run
             at ./src/bootstrap/src/core/build_steps/doc.rs:991:26
   8: <bootstrap::core::builder::Builder>::ensure::<bootstrap::core::build_steps::doc::Rustc>
             at ./src/bootstrap/src/core/builder/mod.rs:1607:36
   9: <bootstrap::core::build_steps::test::HtmlCheck as bootstrap::core::builder::Step>::run
             at ./src/bootstrap/src/core/build_steps/test.rs:253:17
  10: <bootstrap::core::builder::Builder>::ensure::<bootstrap::core::build_steps::test::HtmlCheck>
             at ./src/bootstrap/src/core/builder/mod.rs:1607:36
  11: <bootstrap::core::build_steps::test::HtmlCheck as bootstrap::core::builder::Step>::make_run
             at ./src/bootstrap/src/core/build_steps/test.rs:240:21
  12: <bootstrap::core::builder::StepDescription>::maybe_run
             at ./src/bootstrap/src/core/builder/mod.rs:476:13
  13: bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run
             at ./src/bootstrap/src/core/builder/cli_paths.rs:141:22
  14: <bootstrap::core::builder::Builder>::run_step_descriptions
             at ./src/bootstrap/src/core/builder/mod.rs:1140:9
  15: <bootstrap::core::builder::Builder>::execute_cli
             at ./src/bootstrap/src/core/builder/mod.rs:1119:14
  16: <bootstrap::Build>::build
             at ./src/bootstrap/src/lib.rs:803:25
  17: bootstrap::main
             at ./src/bootstrap/src/bin/main.rs:130:11
  18: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/core/src/ops/function.rs:250:5
  19: std::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/sys/backtrace.rs:166:18
  20: std::rt::lang_start::<()>::{closure#0}
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/rt.rs:206:18
  21: <&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe as core::ops::function::FnOnce<()>>::call_once
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/core/src/ops/function.rs:287:21
  22: std::panicking::catch_unwind::do_call::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panicking.rs:581:40
  23: std::panicking::catch_unwind::<i32, &dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panicking.rs:544:19
  24: std::panic::catch_unwind::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panic.rs:359:14
  25: std::rt::lang_start_internal::{closure#0}
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/rt.rs:175:24
  26: std::panicking::catch_unwind::do_call::<std::rt::lang_start_internal::{closure#0}, isize>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panicking.rs:581:40
---
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/rt.rs:205:5
  31: _main


Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `--stage 2 test --host=aarch64-apple-darwin --target=aarch64-apple-darwin`
Build completed unsuccessfully in 2:01:26
  local time: Tue Jul  7 19:26:10 UTC 2026
  network time: Tue, 07 Jul 2026 19:26:10 GMT
##[error]Process completed with exit code 1.

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

💔 Test for f22e05f failed: CI. Failed job:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants