Skip to content

Rollup of 14 pull requests#157708

Closed
JonathanBrouwer wants to merge 37 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-FhlrVnc
Closed

Rollup of 14 pull requests#157708
JonathanBrouwer wants to merge 37 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-FhlrVnc

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Successful merges:

Failed merges:

r? @ghost

Create a similar rollup

s7tya and others added 30 commits May 29, 2026 04:37
WF-checking walks through higher-ranked binders without instantiating
them, so a `dyn Trait` nested inside a `for<'a>` bound reaches the
`ty::Dynamic` arm of `WfPredicates::visit_ty` while still carrying
escaping bound vars. Feeding that type into
`ExistentialTraitRef::with_self_ty` violated its no-escaping-self
precondition and tripped the assertion that guards it.

The trait ref built there is only used to read off `ConstArgHasType`
clauses, which constrain the trait's own const arguments and never
mention the `Self` type. Substitute a fresh placeholder self type when
the real one escapes: the assertion holds and the const-argument check
is still performed. Re-enable the `with_self_ty` debug assertion now
that its precondition is upheld.
One test covers the original ICE (a `dyn Trait` nested in a `for<'a>`
bound, distilled from itertools). The other locks in that a const
argument on such a nested `dyn` is still type-checked, so the
placeholder-self-type fix cannot silently regress into dropping the
`ConstArgHasType` check.
The in-memory dep graph kept for `-Zquery-dep-graph` is built by
`GraphEncoder::record`, which pushed each node using `try_lock` and
silently dropped the node when the lock was contended. Single-threaded
the only contention is a query forced re-entrantly from within
`with_retained_dep_graph`, so dropping was harmless. Under the parallel
frontend several encoder threads record nodes at the same time, so a
contended `try_lock` dropped nodes and edges at random, leaving the
retained graph nondeterministic and making the dep-graph ui tests, which
assert on its contents, fail intermittently.

Remove that reentrancy in `check_paths`: read the graph into owned
results while the lock is held, then emit the diagnostics afterwards.
The only query forced inside the old closure was `def_path_str` (for the
error messages), which can create dep nodes and re-enter the encoder;
doing the emission after the lock is released means `record` never
re-enters while the lock is held. `record` can then block on the lock
unconditionally instead of using `try_lock`, so concurrent encoders
never drop a node or edge.

This only affects compilation with `-Zquery-dep-graph`; with the flag
off the retained graph is absent and nothing changes.
These tests assert on the contents of the retained dep graph, which is now
built deterministically under the parallel frontend, so they no longer need
to be ignored there. Replace the ignore-parallel-frontend directives with
blank lines rather than deleting them, so the following line numbers stay the
same and the expected output is unchanged.
WF-checking can reach ExistentialTraitRef::with_self_ty with a dyn
principal that still carries escaping bound vars, e.g. a dyn nested in
a for<'a> bound, which tripped the debug assertion forbidding escaping
self types and ICEd when compiling itertools.

Building such a trait ref is fine: escaping bound vars are caught where
it is actually used. Remove the assertion rather than working around it,
which lets the WF visitor pass the type through unchanged and drops the
placeholder-self-type detour.
Co-authored-by: Ryan Mehri <52933714+rmehri01@users.noreply.github.com>
…escaping_bound_vars_assert, r=lcnr

traits: Allow escaping self types in ExistentialTraitRef::with_self_ty

Fixes rust-lang#157122

WF-checking recurses through higher-ranked binders without instantiating them, so a `dyn Trait` nested inside a `for<'a>` binder reaches the `ty::Dynamic` arm of `WfPredicates::visit_ty` while still carrying escaping bound vars. Building the principal trait ref there via `ExistentialTraitRef::with_self_ty` hands that escaping self type to a `debug_assert!(!self_ty.has_escaping_bound_vars())`, which ICEs once the assertion is enabled. The assert was accidentally disabled in 2018 refactor rust-lang#53816, and the `// FIXME(rust-lang#157122)` left in its place asks whether to remove it or fix the fallout.

An escaping bound var is expected for trait objects, and we already catch trait refs with escaping bound vars at the places that actually use them — so creating one here is fine. Rather than work around the assert in WF, this removes the assert and its stale FIXME from `with_self_ty`.

Two regression tests pin the behavior:
- `wf-dyn-in-hrtb-bound-issue-157122.rs` reproduces the original ICE (`dyn` nested in an HRTB bound).
- `wf-dyn-in-hrtb-bound-const-mismatch.rs` checks that the `ConstArgHasType` obligation this arm reads off still fires, so an ill-typed const argument on such a `dyn` keeps erroring instead of compiling clean.
…trochenkov

Fix post-monomorphization error note race in the parallel frontend

Fixes rust-lang#154260. Part of rust-lang#154314.

`collect_items_rec` decides whether to attach the note "the above error was encountered while instantiating `fn ...`" by snapshotting the error count before processing a mono item and comparing it afterwards. The mono item graph is walked in parallel (the `par_for_each_in` in `collect_crate_mono_items`), so the global error count can be bumped by an error emitted while collecting a different item on another thread between the two reads. That makes an unrelated item get blamed, which showed up as a spurious note when using parallel frontend:

```
note: the above error was encountered while instantiating `fn std::rt::lang_start::<()>`
```

This PR records the thread that emits each error alongside its `ErrorGuaranteed` in `err_guars`, `lint_err_guars`, and the stashed-diagnostics map, and add `err_count_on_current_thread`, which counts only the errors whose recorded thread is the calling thread. The collector uses it for the snapshot and comparison, so the delta is not affected by errors emitted on other threads. In serial compilation it is equivalent to a delta of `err_count`.
…rminism, r=petrochenkov

Make the retained dep graph deterministic under the parallel frontend

Part of rust-lang#154314.

The in-memory dep graph kept for `-Zquery-dep-graph` is built by `GraphEncoder::record`, which pushed each node using `try_lock` and silently dropped the node when the lock was contended. Single-threaded the only contention is a query forced re-entrantly from within `with_retained_dep_graph`, so dropping was harmless. Under the parallel frontend several encoder threads record nodes at the same time, so a contended `try_lock` dropped nodes and edges at random, leaving the retained graph nondeterministic. The dep-graph ui tests, which assert on its contents, then failed intermittently.

The reentrancy came from `check_paths` emitting its diagnostics while holding the retained graph: the error path calls `def_path_str`, which can create new dep nodes and re-enter the encoder. This reads the path results into owned values while the lock is held and emits the diagnostics afterwards, so `record` never re-enters while the lock is held. `record` can then block on the lock unconditionally instead of using `try_lock`, so concurrent encoders never drop a node or edge.
…target-expr-error, r=petrochenkov

Emit error for unused target expression in glob and list delegations

This PR emits error if unuse  target expression is specified for glob delegation. Second part of rust-lang#156798.

Part of rust-lang#118212.
r? @petrochenkov
…by789

Autogenerate unstable compiler flag stubs for unstable-book

Closes rust-lang#141525.

Based on old PR rust-lang#142135.

Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
…e1-dead

Start using comptime for reflection intrinsics and their wrapper functions

r? @fee1-dead

follow-up to rust-lang#148820

I needed to add some more rustc code because turns out I forgot to add tests to the previous PR which actually codegen while using comptime fns. Check builds never try to create optimized MIR, so no code ever hit the assert that prevents creating optimized MIR for comptime fns.
Ensure inferred let pattern types are well-formed

Fixes rust-lang#150040

This registers a well-formedness obligation for inferred `let` pattern types when the pattern contains `ref` bindings.

Previously, `let PAT;` without an explicit type annotation could infer a non-well-formed pattern input type, such as `[str; 2]` or `(str, str)`. Some bindings inside the pattern can still have well-formed local types, for example `ref x` gives `x: &str`, so checking only the binding locals missed the enclosing array or tuple type. As a result, invalid unsized array/tuple pattern types were accepted and could later lead to layout ICEs.

The new check registers a WF obligation for the inferred declaration type after pattern checking.
…apin

Fix doc link to Instant sub in saturating caveat

The `sub` link in the caveat about saturating subtraction for `Instant` was linking to the wrong implementation of `sub`. On https://doc.rust-lang.org/std/time/struct.Instant.html it was linking to `Instant - Duration` which in fact *is not saturating*, and *will* panic. It should link to `Instant - Instant`.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jun 10, 2026
@rustbot rustbot added 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-compiler Relevant to the compiler 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. labels Jun 10, 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,aarch64-msvc-1

@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7ee75f1 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 Jun 10, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
Rollup of 14 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
try-job: aarch64-msvc-1
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #157280 (traits: Allow escaping self types in ExistentialTraitRef::with_self_ty)
 - #157282 (Fix post-monomorphization error note race in the parallel frontend)
 - #157352 (Make the retained dep graph deterministic under the parallel frontend)
 - #157601 (Emit error for unused target expression in glob and list delegations)
 - #157626 (Autogenerate unstable compiler flag stubs for unstable-book)
 - #157647 (Start using comptime for reflection intrinsics and their wrapper functions)
 - #157013 (Ensure inferred let pattern types are well-formed)
 - #157288 (platform support: add SNaN erratum to MIPS targets)
 - #157355 (Add `or_try_*` variants for `HashMap` and `BTreeMap` Entry APIs)
 - #157577 (Fix parser error recovery treating 'dyn' as a strict keyword in Rust …)
 - #157670 (Rename `errors.rs` file to `diagnostics.rs` (4/N))
 - #157691 (Move symbol hiding code to a new file)
 - #157700 (Rename `errors.rs` file to `diagnostics.rs` (5/N))
 - #157703 (Fix doc link to Instant sub in saturating caveat)

Failed merges:

 - #157699 (Arg splat experiment - hir FnDecl impl)
@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 10, 2026
@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 0b6538b failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Contributor Author

@bors retry

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #157280 (traits: Allow escaping self types in ExistentialTraitRef::with_self_ty)
 - #157282 (Fix post-monomorphization error note race in the parallel frontend)
 - #157352 (Make the retained dep graph deterministic under the parallel frontend)
 - #157601 (Emit error for unused target expression in glob and list delegations)
 - #157626 (Autogenerate unstable compiler flag stubs for unstable-book)
 - #157647 (Start using comptime for reflection intrinsics and their wrapper functions)
 - #157013 (Ensure inferred let pattern types are well-formed)
 - #157288 (platform support: add SNaN erratum to MIPS targets)
 - #157355 (Add `or_try_*` variants for `HashMap` and `BTreeMap` Entry APIs)
 - #157577 (Fix parser error recovery treating 'dyn' as a strict keyword in Rust …)
 - #157670 (Rename `errors.rs` file to `diagnostics.rs` (4/N))
 - #157691 (Move symbol hiding code to a new file)
 - #157700 (Rename `errors.rs` file to `diagnostics.rs` (5/N))
 - #157703 (Fix doc link to Instant sub in saturating caveat)

Failed merges:

 - #157699 (Arg splat experiment - hir FnDecl impl)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 46a9afd (46a9afdf673adfb1683c6fc2d270bb761f80e125, parent: ab26b175979ee7b2cb3302dce204b99df96f7efb)

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-stable failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   1: core::panicking::panic_fmt
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/core/src/panicking.rs:80:14
   2: unstable_book_gen::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/unstable-book-gen /checkout/library /checkout/compiler /checkout/src /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/rustc /checkout/obj/build/x86_64-unknown-linux-gnu/md-doc/unstable-book` failed with exit code 101
Created at: src/bootstrap/src/core/build_steps/tool.rs:1624:23
Executed at: src/bootstrap/src/core/build_steps/doc.rs:1320:13

--- BACKTRACE vvv
   0: <bootstrap::utils::exec::DeferredCommand>::finish_process
             at /checkout/src/bootstrap/src/utils/exec.rs:939:17
   1: <bootstrap::utils::exec::DeferredCommand>::wait_for_output::<&bootstrap::utils::exec::ExecutionContext>
             at /checkout/src/bootstrap/src/utils/exec.rs:831:21
   2: <bootstrap::utils::exec::ExecutionContext>::run
             at /checkout/src/bootstrap/src/utils/exec.rs:741:45
   3: <bootstrap::utils::exec::BootstrapCommand>::run::<&bootstrap::core::builder::Builder>
             at /checkout/src/bootstrap/src/utils/exec.rs:339:27
   4: <bootstrap::core::build_steps::doc::UnstableBookGen as bootstrap::core::builder::Step>::run
             at /checkout/src/bootstrap/src/core/build_steps/doc.rs:1320:13
   5: <bootstrap::core::builder::Builder>::ensure::<bootstrap::core::build_steps::doc::UnstableBookGen>
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1596:36
   6: <bootstrap::core::build_steps::doc::UnstableBook as bootstrap::core::builder::Step>::run
             at /checkout/src/bootstrap/src/core/build_steps/doc.rs:118:14
   7: <bootstrap::core::builder::Builder>::ensure::<bootstrap::core::build_steps::doc::UnstableBook>
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1596:36
   8: <bootstrap::core::build_steps::doc::UnstableBook as bootstrap::core::builder::Step>::make_run
             at /checkout/src/bootstrap/src/core/build_steps/doc.rs:110:21
   9: <bootstrap::core::builder::StepDescription>::maybe_run
             at /checkout/src/bootstrap/src/core/builder/mod.rs:476:13
  10: bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run
             at /checkout/src/bootstrap/src/core/builder/cli_paths.rs:141:22
  11: <bootstrap::core::builder::Builder>::run_step_descriptions
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1139:9
---
  14: <bootstrap::core::builder::Builder>::ensure::<bootstrap::core::build_steps::test::Linkcheck>
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1596:36
  15: <bootstrap::core::build_steps::test::Linkcheck as bootstrap::core::builder::Step>::make_run
             at /checkout/src/bootstrap/src/core/build_steps/test.rs:140:21
  16: <bootstrap::core::builder::StepDescription>::maybe_run
             at /checkout/src/bootstrap/src/core/builder/mod.rs:476:13
  17: bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run
             at /checkout/src/bootstrap/src/core/builder/cli_paths.rs:141:22
  18: <bootstrap::core::builder::Builder>::run_step_descriptions
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1139:9
  19: <bootstrap::core::builder::Builder>::execute_cli
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1118:14
  20: <bootstrap::Build>::build
             at /checkout/src/bootstrap/src/lib.rs:803:25
  21: bootstrap::main
             at /checkout/src/bootstrap/src/bin/main.rs:130:11
  22: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/core/src/ops/function.rs:250:5
  23: std::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/sys/backtrace.rs:166:18
  24: std::rt::lang_start::<()>::{closure#0}
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/rt.rs:206:18
  25: <&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
  26: 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
  27: 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
  28: 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
  29: std::rt::lang_start_internal::{closure#0}
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/rt.rs:175:24
  30: std::panicking::catch_unwind::do_call::<std::rt::lang_start_internal::{closure#0}, isize>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panicking.rs:581:40
---
  37: __libc_start_main
  38: _start


Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `--stage 2 test`
Build completed unsuccessfully in 1:28:35
  local time: Wed Jun 10 16:59:39 UTC 2026
  network time: Wed, 10 Jun 2026 16:59:39 GMT
##[error]Process completed with exit code 1.

@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for f787c60 failed: CI. Failed job:

@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 10, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 10, 2026
@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

PR #157626, which is a member of this rollup, was unapproved.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rollup A PR which is a rollup T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.