308847 Commits

Author SHA1 Message Date
bors
647f1536d2 Auto merge of #148314 - matthiaskrgr:rollup-yo55adr, r=matthiaskrgr
Some checks failed
Post merge analysis / analysis (push) Has been cancelled
GHCR image mirroring / DockerHub mirror (push) Has been cancelled
Bump dependencies in Cargo.lock / skip if S-waiting-on-bors (push) Has been cancelled
Bump dependencies in Cargo.lock / update dependencies (push) Has been cancelled
Bump dependencies in Cargo.lock / amend PR (push) Has been cancelled
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#144291 (Constify trait aliases)
 - rust-lang/rust#147633 (Add new `--bypass-ignore-backends` option)
 - rust-lang/rust#148252 (Improve diagnose for unconditional panic when resource limit)
 - rust-lang/rust#148262 (Fix types being marked as dead when they are inferred generic arguments)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-31 01:57:02 +00:00
Matthias Krüger
224aab4223 Rollup merge of #148262 - JonathanBrouwer:dead-code-inference, r=nnethercote
Fix types being marked as dead when they are inferred generic arguments

Previously usages of a type in a pattern were ignored. This is incorrect, since if the type is in a pattern we're clearly producing it in the expression we're matching against.

I think this `in_pat` check was meant to be only for variants, which we should indeed ignore since we can just remove the match arm that matches the pattern. Please double check my logic here since this is my first time touching the dead-code pass and I'm not 100% sure this is what the `self.in_pat` check was for.

Fixes https://github.com/rust-lang/rust/issues/148144
2025-10-31 02:39:17 +01:00
Matthias Krüger
d399bc07f3 Rollup merge of #148252 - Binlogo:threads-outrage-diagnose-tips, r=nnethercote
Improve diagnose for unconditional panic when resource limit

Improve diagnostic message for similar issue rust-lang/rust#115021.

When `parallel_compiler=true`, the Rust compiler frontend sets `-Z threads` to match the number of cores, which is reasonable and common. However, in a constrained environment or with an excessive number of cores (such as 377 mentioned below 😑), it could consume all resources and cause a panic.

Setting a default maximum for `-Z threads` in a parallel compiler is challenging. However, the panic error message can guide the user to check the system limit and explicitly lower the thread count according to their needs.

```
14:55:47 thread 'main' panicked at /rustc/f1586001ace26df7cafeb6534eaf76fb2c5513e5/compiler/rustc_interface/src/util.rs:216:18:

14:55:47 called `Result::unwrap()` on an `Err` value: ThreadPoolBuildError { kind: IOError(Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }) }

...

14:55:47 note: compiler flags: --crate-type lib -C opt-level=z -C embed-bitcode=no -C linker=/cache/84996/rust-sdk/target/shim/aarch64-unknown-linux-ohos/clang -Z unstable-options -C symbol-mangling-version=v0 -Z panic-in-drop=abort -C codegen-units=1 -C debuginfo=1 -C embed-bitcode=yes -Z threads=377 -C link-arg=-Wl,--build-id=sha1 -Z binary-dep-depinfo
```
2025-10-31 02:39:16 +01:00
Matthias Krüger
0f1db5302f Rollup merge of #147633 - GuillaumeGomez:bypass-ignore-backends, r=kobzol
Add new `--bypass-ignore-backends` option

Fixes https://github.com/rust-lang/rust/issues/147063.

It adds a new option to `bootstrap` to allow to ignore `//@ ignore-backends` statements in tests.

cc ```@jieyouxu``` ```@antoyo```
r? ```@Kobzol```
2025-10-31 02:39:15 +01:00
Matthias Krüger
149ad71e05 Rollup merge of #144291 - oli-obk:const_trait_alias, r=fee1-dead
Constify trait aliases

Allow `const trait Foo = Bar + [const] Baz;` trait alias declarations. Their rules are the same as with super traits of const traits. So `[const] Baz` or `const Baz` is only required for `[const] Foo` or `const Foo` bounds respectively.

tracking issue rust-lang/rust#41517 (part of the general trait alias feature gate, but I can split it out into a separate const trait alias feature gate. I just assumed that const traits would stabilize before trait aliases, and we'd want to stabilize trait aliases together with const trait aliases at the same time)

r? ``@compiler-errors`` ``@fee1-dead``
2025-10-31 02:39:14 +01:00
bors
ab4960e680 Auto merge of #148298 - jieyouxu:revert-cc, r=madsmtm
Revert "Auto merge of #146186 - dpaoliello:cc, r=jieyouxu"

This reverts https://github.com/rust-lang/rust/pull/146186. This will mean regressing whichever `cc` fixes were needed for

> fixes when compiling the Rust compiler for Arm64EC.

It's not clear which `cc` change causes the across-the-board perf regression, I suspect it's a change in how certain compiler flags are handed. But I can immediately tell this is a rabbit hole to investigate, so let's revert for now to return-to-baseline and alleviate time pressure.
2025-10-30 22:47:42 +00:00
bors
d5419f1e97 Auto merge of #148299 - bjorn3:dummy_backend_check_builds, r=jieyouxu
Allow check builds with binaries for the dummy codegen backend

This is likely the last part necessary for https://github.com/rust-lang/miri/pull/4648. Miri needs to be able to do a regular check build for compile_fail doc tests to work.
2025-10-30 17:36:26 +00:00
bjorn3
4b9dc49975 Allow check builds with binaries for the dummy codegen backend 2025-10-30 15:13:05 +00:00
Jieyou Xu
2b9b7bb3d4 Revert "Auto merge of #146186 - dpaoliello:cc, r=jieyouxu"
This reverts commit bc1d7273df, reversing
changes made to c9537a94a6.
2025-10-30 22:46:35 +08:00
bors
8205e6b75e Auto merge of #148291 - purplesyringa:move-throw-to-unwind, r=bjorn3
Move wasm `throw` intrinsic back to `unwind`

Fixes rust-lang/rust#148246, less invasive than the previously proposed rust-lang/rust#148269. Removes the publicly visible unstable intrinsic tracked in rust-lang/rust#122465 since it's not clear how to export it in a sound manner.

r? `@bjorn3`

---

rustc assumes that regular `extern "Rust"` functions unwind only if the `unwind` panic runtime is linked. `throw` was annotated as such, but unwound unconditionally. This could cause UB when a crate built with `-C panic=abort` called `throw` from `core` built with `-C panic=unwind`, since no terminator was added to handle the panic arising from calling an allegedly non-unwinding `extern "Rust"` function.

rustc was taught to recognize this condition since https://github.com/rust-lang/rust/pull/144225 and prevented such linkage, but this caused regressions in
https://github.com/rust-lang/rust/issues/148246, since this meant that Emscripten projects could not be built with `-C panic=abort` without recompiling std.

The most straightforward solution would be to move `throw` into the `panic_unwind` crate, so that it's only compiled if the panic runtime is guaranteed to be `unwind`, but this is messy due to our architecture. Instead, move it into `unwind::wasm`, which is only compiled for bare-metal targets that default to `panic = "abort"`, rendering the issue moot.
2025-10-30 13:17:11 +00:00
Alisa Sireneva
420544a34a Move wasm throw intrinsic back to unwind
rustc assumes that regular `extern "Rust"` functions unwind only if the
`unwind` panic runtime is linked. `throw` was annotated as such, but
unwound unconditionally. This could cause UB when a crate built with `-C
panic=abort` called `throw` from `core` built with `-C panic=unwind`,
since no terminator was added to handle the panic arising from calling an
allegedly non-unwinding `extern "Rust"` function.

rustc was taught to recognize this condition since
https://github.com/rust-lang/rust/pull/144225 and prevented such
linkage, but this caused regressions in
https://github.com/rust-lang/rust/issues/148246, since this meant that
Emscripten projects could not be built with `-C panic=abort` without
recompiling std.

The most straightforward solution would be to move `throw` into the
`panic_unwind` crate, so that it's only compiled if the panic runtime is
guaranteed to be `unwind`, but this is messy due to our architecture.
Instead, move it into `unwind::wasm`, which is only compiled for
bare-metal targets that default to `panic = "abort"`, rendering the
issue moot.
2025-10-30 15:13:32 +03:00
bors
6906167e01 Auto merge of #148193 - camsteffen:remove-qpath-langitem, r=cjgillot
Remove `QPath::LangItem`

Closes rust-lang/rust#115178.

r? cjgillot
2025-10-30 10:04:21 +00:00
Oli Scherer
ebb249d69e Fix formatting of const trait aliases 2025-10-30 08:05:37 +00:00
Oli Scherer
a6ca44cf40 Add more tests 2025-10-30 08:05:37 +00:00
Oli Scherer
b9e7cf61be Make const trait aliases work in the old solver 2025-10-30 08:05:37 +00:00
Oli Scherer
bc4d612d46 Prepare test for old solver 2025-10-30 08:05:37 +00:00
Oli Scherer
544a5a3e0e Make const trait aliases work in next solver 2025-10-30 08:05:37 +00:00
Oli Scherer
8b122f1e11 Generate const predicates for const trait aliases 2025-10-30 08:05:37 +00:00
Oli Scherer
5f6772c2a7 Constify trait aliases 2025-10-30 08:05:37 +00:00
Jonathan Brouwer
a09c4fc862 Fix types being marked as dead when they are inferred generic arguments
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-30 08:31:07 +01:00
bors
72fe2ffb39 Auto merge of #148280 - jhpratt:rollup-um01cgu, r=jhpratt
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#138217 (Turn `Cow::is_borrowed,is_owned` into associated functions.)
 - rust-lang/rust#147858 (Micro-optimization attempt in coroutine layout computation)
 - rust-lang/rust#147923 (Simplify rustc_public context handling)
 - rust-lang/rust#148115 (rustdoc: Rename unstable option `--nocapture` to `--no-capture` in accordance with `libtest`)
 - rust-lang/rust#148137 (Couple of changes for Redox OS)
 - rust-lang/rust#148176 ([rustdoc] Include attribute and derive macros when filtering on "macros")
 - rust-lang/rust#148253 (Handle default features and -Ctarget-features in the dummy backend)
 - rust-lang/rust#148272 (Align VEX V5 boot routine to 4 bytes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-30 06:55:29 +00:00
Jacob Pratt
4796814045 Rollup merge of #148272 - vexide:fix/linker-script-align, r=saethlin
Align VEX V5 boot routine to 4 bytes

This PR fixes an alignment issue with the initialization routine on the VEX V5 target.

Previously, if the `.text` output section contained any functions aligned to more than four bytes, the linker would add padding bytes before the beginning of `.text` rather than changing the position of the aligned function inside the section itself. This is an issue because the entry point for the program needs to be located at `0x3800_0020` on this platform and the addition of padding could cause it to be moved.

To fix this, I've forced the start address of the `.text` section to be aligned to 4 bytes so that the entry point is placed consistently. Items inside the section can still be aligned to values larger than this.
2025-10-30 02:43:46 -04:00
Jacob Pratt
f76239ce1f Rollup merge of #148253 - bjorn3:dummy_backend_target_features, r=JonathanBrouwer
Handle default features and -Ctarget-features in the dummy backend

This prevents a warning about ABI relevant target features not being set on x86 and arm. In addition it is required for miri to report correct features in is_*_feature_detected!() if miri switches to the dummy backend.

Required for https://github.com/rust-lang/miri/pull/4648
2025-10-30 02:43:46 -04:00
Jacob Pratt
645e41abd7 Rollup merge of #148176 - GuillaumeGomez:filter-macros, r=notriddle
[rustdoc] Include attribute and derive macros when filtering on "macros"

As discussed [here](https://github.com/rust-lang/rust/pull/147909), some filters should have been "grouped". This PR allows attribute and derive macros to match the `macro` filter.

I'll wait for https://github.com/rust-lang/rust/pull/148005 to add more tests as it would require a proc-macro library for now.

r? ```@notriddle```
2025-10-30 02:43:45 -04:00
Jacob Pratt
a7491882e5 Rollup merge of #148137 - bjorn3:redox_fixes, r=mati865
Couple of changes for Redox OS

This upstreams all redox patches that can be upstreamed.

cc ```@jackpot51```
2025-10-30 02:43:44 -04:00
Jacob Pratt
35fcb55827 Rollup merge of #148115 - fmease:rustdoc-no-capture, r=notriddle
rustdoc: Rename unstable option `--nocapture` to `--no-capture` in accordance with `libtest`

Context: https://github.com/rust-lang/rust/issues/133073, https://github.com/rust-lang/rust/pull/139224 (TL;DR: `libtest` has soft-deprecated `--nocapture` in favor a new & stable `--no-capture`; we should follow suit).

Since the rustdoc flag is unstable (tracking issue: https://github.com/rust-lang/rust/issues/148116), we're allowed to remove the old flag immediately. However since the flag has existed for 4 years we could hard-deprecate the flag first or at least be considerate and provide a diagnostic referring users to the new flag. This PR does neither. Let me know what you would think would be best.

Cargo doesn't use this flag, not yet at least (https://github.com/rust-lang/cargo/pull/9705), so we really are free to sunset this flag without bigger consequences.
2025-10-30 02:43:43 -04:00
Jacob Pratt
2e4e4abf44 Rollup merge of #147923 - celinval:rpub-remove-trait, r=oli-obk
Simplify rustc_public context handling

We no longer need two thread-local variables to store the context. We used to have two because the conversion logic used to live in a separate crate from the rest of the business logic.

I'm also merging the Container struct and the CompilerInterface trait as a single struct. This removes the unnecessary indirection and code duplication. Using a trait would also block us from adding any generic method to the compiler interface.

r? ``@oli-obk``

cc: ``@makai410``
2025-10-30 02:43:42 -04:00
Jacob Pratt
1ae00ba888 Rollup merge of #147858 - yotamofek:pr/mir/coroutine-layout-opt, r=cjgillot
Micro-optimization attempt in coroutine layout computation

In `compute_layout`, there were a bunch of collections (`IndexVec`s) that were being created by `push`ing in a loop, instead of a, hopefully, more performant usage of iterator combinators. [Second commit](6f682c2774) is just a small cleanup.

I'd love a perf run to see if this shows up in benchmarks.
2025-10-30 02:43:42 -04:00
Jacob Pratt
f1a0dfd145 Rollup merge of #138217 - theemathas:cow_is_owned_borrowed_associated, r=dtolnay
Turn `Cow::is_borrowed,is_owned` into associated functions.

This is done because `Cow` implements `Deref`. Therefore, to avoid conflicts with an inner type having a method of the same name, we use an associated method, like `Box::into_raw`.

Tracking issue: #65143
2025-10-30 02:43:41 -04:00
Celina G. Val
e0b8dd38bc Simplify rustc_public context handling
We no longer need two thread-local variables to store the context.
We used to have two because the conversion logic used to live in a
separate crate from the rest of the business logic.

I'm also removing the Container struct and replacing the
CompilerInterface trait with a struct. This removes the unnecessary
indirection and code duplication. Using a trait would also block us
from adding any generic method to the compiler interface.
2025-10-29 23:31:50 +00:00
Lewis McClelland
958d0a3836 Align VEX V5 boot routine to 4 bytes 2025-10-29 17:52:05 -04:00
Guillaume Gomez
8cf55ea51c Rename bypass_backends into bypass_ignore_backends 2025-10-29 19:49:24 +01:00
bors
292be5c7c0 Auto merge of #148093 - Azzybana:master, r=nnethercote
perf: removed unnecessary let for return only in layout.rs

perf: removed unnecessary let for return only
2025-10-29 15:37:05 +00:00
bjorn3
4d7c784caf Handle default features and -Ctarget-features in the dummy backend
This prevents a warning about ABI relevant target features not being set
on x86 and arm. In addition it is required for miri to report correct
features in is_*_feature_detected!() if miri switches to the dummy backend.
2025-10-29 13:43:14 +00:00
Binlogo
5aa2a90724 Improve diagnose for unconditional panic when resource limit 2025-10-29 21:21:25 +08:00
bjorn3
fa0f1630d6 Add riscv64gc-unknown-redox
Co-Authored-By: Jeremy Soller <jackpot51@gmail.com>
2025-10-29 13:15:12 +00:00
Jeremy Soller
bd61985bb6 Disable crt_static_allows_dylibs in redox targets 2025-10-29 13:14:54 +00:00
Guillaume Gomez
36ac107e3d Add rustc-dev-guide documentation for new --bypass-ignore-backends command line flag 2025-10-29 14:11:07 +01:00
Guillaume Gomez
d6d9fa8efd Add new --bypass-ignore-backends option 2025-10-29 14:11:07 +01:00
bors
292db4a13c Auto merge of #148245 - matthiaskrgr:rollup-rudy14y, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#148159 (Move rustdoc tests to appropriate subdirectories)
 - rust-lang/rust#148218 (Update T-compiler/ops Zulip messages)
 - rust-lang/rust#148228 (Run regression test for rust-lang/rust#147964 on next solver too)
 - rust-lang/rust#148237 (citool: Always print a signed percentage in job duration changes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-29 12:28:54 +00:00
Matthias Krüger
e677944d3a Rollup merge of #148237 - Zalathar:analysis-signed, r=Kobzol
citool: Always print a signed percentage in job duration changes

I found myself confused by these percentage deltas, because it's not immediately obvious whether a change of 110% means “a little bit worse” (+10%, 110% overall) or ”more than twice as long” (+110%, 210% overall). The correct interpretation is “more than twice as long”.

Including a sign for positive percentages should hopefully make it clearer that they are relative to a baseline of ±0%, not a baseline of 100%.

Manually tested with:
```text
cargo run --manifest-path src/ci/citool/Cargo.toml post-merge-report df984edf44 c9537a94a6
```

r? Kobzol
2025-10-29 12:57:06 +01:00
Matthias Krüger
6985d9a075 Rollup merge of #148228 - clarfonthey:regression-next-solver, r=nnethercote
Run regression test for #147964 on next solver too

Original regression: rust-lang/rust#147964
Longer-term tracking of issue: rust-lang/rust#148028

For now, this just makes sure that whatever tests we keep are working the same under both the current solver and the next solver, until we decide what to do with them.
2025-10-29 12:57:05 +01:00
Matthias Krüger
b9b8435543 Rollup merge of #148218 - apiraino:update-prio-zulip-mesgs, r=Urgau,jieyouxu
Update T-compiler/ops Zulip messages

Slightly reword the issue prioritization and beta backport Zulip messages

r? `@jieyouxu` wdyt? (we discussed together this wording)
2025-10-29 12:57:05 +01:00
Matthias Krüger
78791eb223 Rollup merge of #148159 - politikl:move-rustdoc-tests-to-subdirs, r=GuillaumeGomez
Move rustdoc tests to appropriate subdirectories

## Summary

This PR reorganizes rustdoc tests into their correct subdirectories for better categorization and maintainability.

## Changes

- Moved 6 lint-related tests to `tests/rustdoc-ui/lints/`
- Moved 2 intra-doc link tests to `tests/rustdoc-ui/intra-doc/`
- Moved 3 deref-related tests to `tests/rustdoc-ui/deref/`
- Moved 1 doc-cfg test to `tests/rustdoc/doc-cfg/`

## Tests

All moved tests have been verified and pass in their new locations.
2025-10-29 12:57:04 +01:00
bors
c6d42d774d Auto merge of #148241 - matthiaskrgr:rollup-4lsapc2, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#144444 (Contract variable declarations)
 - rust-lang/rust#147281 (Make diagnostics clearer for binop-related errors in foreign crates)
 - rust-lang/rust#148131 (Skip parameter attribute deduction for MIR with `spread_arg`)
 - rust-lang/rust#148224 (bootstrap: `ensure(doc::Std)` no longer opens a browser)
 - rust-lang/rust#148226 (Bootstrap update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-29 08:18:04 +00:00
Matthias Krüger
dfaaa1bb7f Rollup merge of #148226 - cuviper:bootstrap-update, r=Mark-Simulacrum
Bootstrap update

- Update CURRENT_RUSTC_VERSION post-bump
- Bump stage0 to 1.92.0-beta.1
- Update `#[cfg(bootstrap)]`
2025-10-29 08:07:51 +01:00
Matthias Krüger
e546800737 Rollup merge of #148224 - jyn514:doc-open, r=Kobzol
bootstrap: `ensure(doc::Std)` no longer opens a browser

In general, the rationale for `--open` is to only open HTML files if they were "explicitly" invoked from the CLI (e.g. `x doc --open library/core`). The existing logic did not do that. Instead it opened the docs unconditionally when a subset of the crates was requested. This is unfortunate for other Steps in bootstrap, which may wish to `ensure()` the standard library docs without opening them.

Change `Std` to check if it was explicitly invoked, rather than assuming it's the case.
2025-10-29 08:07:50 +01:00
Matthias Krüger
9489751d80 Rollup merge of #148131 - tmiasko:deduce-spread-arg, r=wesleywiser
Skip parameter attribute deduction for MIR with `spread_arg`

When a MIR argument is spread at ABI level, deduced attributes are potentially misapplied, since a spread argument can correspond to zero or more arguments at ABI level.

Disable deduction for MIR using spread argument for the time being.
2025-10-29 08:07:50 +01:00
Matthias Krüger
8da95ac135 Rollup merge of #147281 - fee1-dead-contrib:clarify-binop-diag, r=jackh726
Make diagnostics clearer for binop-related errors in foreign crates

Fixes redundant language and bad grammar.
2025-10-29 08:07:49 +01:00
Matthias Krüger
4602127362 Rollup merge of #144444 - dawidl022:contracts/variable-scoping-rebased, r=jackh726
Contract variable declarations

This change adds contract variables that can be declared in the `requires` clause and can be referenced both in `requires` and `ensures`, subject to usual borrow checking rules. This allows any setup common to both the `requires` and `ensures` clauses to only be done once.

In particular, one future use case would be for [Fulminate](https://dl.acm.org/doi/10.1145/3704879)-like ownership assertions in contracts, that are essentially side-effects, and executing them twice would alter the semantics of the contract.

As of this change, `requires` can now be an arbitrary sequence of statements, with the final expression being of type `bool`. They are executed in sequence as expected, before checking if the final `bool` expression holds.

This PR depends on rust-lang/rust#144438 (which has now been merged).

Contracts tracking issue: https://github.com/rust-lang/rust/issues/128044

**Other changes introduced**:
- Contract macros now wrap the content in braces to produce blocks, meaning there's no need to wrap the content in `{}` when using multiple statements. The change is backwards compatible, in that wrapping the content in `{}` still works as before. The macros also now treat `requires` and `ensures` uniformally, meaning the `requires` closure is built inside the parser, as opposed to in the macro.

**Known limiatations**:
- Contracts with variable declarations are subject to the regular borrow checking rules, and the way contracts are currently lowered limits the usefulness of contract variable declarations. Consider the below example:

  ```rust
  #[requires(let init_x = *x; true)]
  #[ensures(move |_| *x == 2 * init_x)]
  fn double_in_place(x: &mut i32) {
      *x *= 2;
  }
  ```

  We have used the new variable declarations feature to remember the initial value pointed to by `x`, however, moving `x` into the `ensures` does not pass the borrow checker, meaning the above function contract is illegal. Ideally, something like the above should be expressable in contracts.
2025-10-29 08:07:49 +01:00