Skip to content

Rustc pull update#2798

Merged
tshepang merged 51 commits intomainfrom
rustc-pull
Mar 16, 2026
Merged

Rustc pull update#2798
tshepang merged 51 commits intomainfrom
rustc-pull

Conversation

@workflows-rustc-dev-guide
Copy link

Latest update from rustc.

bors and others added 30 commits March 9, 2026 04:13
…lacrum

core: respect precision in `ByteStr` `Display`

Fixes rust-lang/rust#153022.

`ByteStr`'s `Display` implementation didn't respect the precision parameter. Just like `Formatter::pad`, this is fixed by counting off the characters in the string and truncating after the requested length – with the added complication that the `ByteStr` needs to be divided into chunks first. By including a fast path that avoids counting the characters when no parameters were specified this should also fix the performance regressions caused by rust-lang/rust#152865.
Enable link relaxation feature for LoongArch Linux targets

This patch series enables the link relaxation feature for LoongArch Linux targets. Link relaxation is a link-time optimization that helps improve the quality and efficiency of the final binary. To support this, the corss-toolchain has also been bumped to handle more types of link relaxation.
- `./x run generate-completions`
- Search and replace `--no-doc` with `--all-targets`
  This is to keep the behaviour the same.
- Document `./x test --tests` in `rustc-dev-guide`
- Add change info
…-Simulacrum,kobzol

Allow `./x test` to run tests without doc tests and without benchmarks

# Problem

For Ferrocene we would like to run only the `coretests` and `alloctests` test suites when measuring code coverage. Running `corebenches` and `allocbenches` would alter the numbers, which is not compliant with the certification.

This is currently not possible in bootstrap. By default `./x test` runs unit, integration and doc tests. `./x test --doc` only runs doc tests. So far, so good.

The problem is that while `./x test --no-doc` stops bootstrap from executing doc tests, it surprisingly starts executing benchmarks (next to examples and bins as well). It basically behaves like `cargo test --all-targets`.

# Solution

This PR renames the existing `--no-doc` flag to `--all-targets` and keeps the same behaviour as before. Unfortunately it is not possible to internally switch from `cargo --bins --examples --tests --benches` to `cargo --all-targets` because it will fail e.g. `./x test library/alloc --all-targets` with an error like "use of unstable library feature `test`".

Additionally, this PR add a `./x test --tests` flag (equivalent to `cargo test --tests`) that only executes unit and integration tests.

Both changes we are doing in https://github.com/ferrocene/ferrocene anyways, but believe that they may be useful for other people as well and therefore would like to contribute them.

Note that this PR does _not_ change the behaviour of either `./x test` or `./x test --doc`.

## Note on `test = true`

While this change enables bootstrap to run tests without doc tests and without benchmarks, executing `./x test library/core library/alloc --tests` will still build and execute `corebenches` and `allocbenches`.

What?! 😱 Why all of this effort to enable it then?

Good question! The reason they are still executed is, that they are marked with `test = true` in their respective `Cargo.toml` ([corebenches](https://github.com/rust-lang/rust/blob/3f9853562c73af38a5e6af8b0da1b2734a327e19/library/coretests/Cargo.toml#L24), [allocbenches](https://github.com/rust-lang/rust/blob/3f9853562c73af38a5e6af8b0da1b2734a327e19/library/alloctests/Cargo.toml#L32)).

@bjorn3 mentioned that it is important for upstream that those benchmarks are executed by default, even if no `./x --all-targets` is passed. This is perfectly possible with this PR. Benchmarks marked with `test = true` will be executed when calling either of `./x test`, `./x test --tests` or `./x --all-targets`. Therefore this PR does not include a commit to change that. We will just do this change in https://github.com/ferrocene/ferrocene.

## Open questions

### Error message

I added one commit that adds an error message if a user passes `--no-doc` and points them to `--all-targets` and `--tests`. I think it might be nice to have, but if you think it is not necessary, I can remove it.

# How to test this change

You can see the change in action by running `./x test library/alloc --tests` and `./x test library/alloc --all-targets`. The first will execute `alloctests` and `allocbenches` (which is marked with `test = true`), while the second will additionally run `benches/vec_deque_append.rs` (which is _not_ marked with `test = true`).
Refactor `ActiveJobGuard`

A few small improvements.

r? @petrochenkov
…nkov

`QueryLatch` cleanups

A couple of small improvements I found while reading through this code.

r? @petrochenkov
scalable vector: type renames and simple checks

Split out from rust-lang/rust#153286

Per rust-lang/rust#153286 (comment), renames `VectorKind` type to `SimdVectorKind` and `BackendRepr::ScalableVector` to `BackendRepr::SimdScalableVector`. Also adds a new check in `rustc_hir_analysis` enforcing that tuples of scalable vectors should only up to eight vectors.

r? @lqd
fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself

Some environment variables (e.g. `CARGO_BIN_NAME`) are only available for some targets ([Cargo Targets](https://doc.rust-lang.org/cargo/reference/cargo-targets.html), [§ Environment variables Cargo sets for crates](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates)), and the current diagnostic when copy-pasting code from a binary to a library is kinda confusing:

```rs
const _: &str = env!("CARGO_BIN_NAME");
```
Before:
```
error: environment variable `CARGO_BIN_NAME` not defined at compile time
 --> lib.rs:1:17
  |
1 | const _: &str = env!("CARGO_BIN_NAME");
  |                 ^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: there is a similar Cargo environment variable: `CARGO_BIN_NAME`
```
After:
```
error: environment variable `CARGO_BIN_NAME` not defined at compile time
 --> lib.rs:1:17
  |
1 | const _: &str = env!("CARGO_BIN_NAME");
  |                 ^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: `CARGO_BIN_NAME` may not be available for the current Cargo target
  = help: Cargo sets build script variables at run time. Use `std::env::var("CARGO_BIN_NAME")` instead
```

@rustbot label +T-compiler +A-diagnostics +D-confusing
…eVoid

feat(rustdoc-json): Add optional support for rkyv (de)serialization

## Motivation

The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.

## An Alternative Approach: rkyv

`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).

## The Change

This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).

I have added new round-trip tests to ensure `rkyv` works as expected.

r? @aDotInTheVoid
Add rationale for intentional potential_query_instability allows

Partial fix for rust-lang/rust#84447.
…t-miscellaneous, r=marcoieni

Fix LegacyKeyValueFormat report from docker build: miscellaneous

Part of rust-lang/rust#152305

Those are the remaining Dockerfile to fix once the other merge requests are merged. Note that this merge request can still be merged before the others.

r? @marcoieni
add test for proc-macros with custom panic payloads

This was not tested anywhere so far.
Avoid projection-only suggestions for inherent assoc types

Fixes rust-lang/rust#153539.

Type mismatch diagnostics in `note_and_explain_type_err` currently route both `ty::Projectio`n and `ty::Inherent`
through the same associated-type suggestion path. For inherent associated types, that path can reach helpers that
are only valid for trait projections.
… r=lqd

triagebot: remove myself from some mention groups

I haven't worked in these areas for a little while, but happy to still be pinged if someone wanted.
Mark an unreachable match arm as such

Synchronize which elements have code paths and which are unreachable betwen def collector and build reduced graph.

Found while analyzing on how to best merge these two visitors in a reviewable way

r? @petrochenkov
…uwer

Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
 - rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
 - rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
 - rust-lang/rust#153595 (`QueryLatch` cleanups)
 - rust-lang/rust#153653 (scalable vector: type renames and simple checks)
 - rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
 - rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
 - rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
 - rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
 - rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
 - rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
 - rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
 - rust-lang/rust#153659 (Mark an unreachable match arm as such)
… r=ZuseZ4

refactor(autodiff): Simplify Autodiff Handling of `rlib` Dependencies

### Summary:

Resolves the two FIXMEs left in rust-lang/rust#149033, per @bjorn3 guidance in [the discussion](rust-lang/rust#149033 (comment)).

Closes rust-lang/rust#149164 

r? @ZuseZ4
cc @bjorn3
The `DerefMut` impl for `Providers` was removed in #151096.
…uwer

Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#153560 (Introduce granular tidy_ctx's check in extra_checks)
 - rust-lang/rust#153666 (Add a regression test for rust-lang/rust#153599)
 - rust-lang/rust#153493 (Remove `FromCycleError` trait)
 - rust-lang/rust#153549 (tests/ui/binop: add annotations for reference rules)
 - rust-lang/rust#153641 (Move `Spanned`.)
 - rust-lang/rust#153663 (Remove `TyCtxt::node_lint` method and `rustc_middle::lint_level` function)
 - rust-lang/rust#153664 (Add test for rust-lang/rust#109804)
…jieyouxu

Add optional CI job to build the compiler with the parallel frontend

Discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Add.20the.20parallel.20front-end.20test.20suite/with/578684794).

Note: this only builds the compiler, stdlib, etc. with 2 threads. UI tests are still compiled serially. I'd add that in a follow-up PR if we see that this new job works well (and if optional auto jobs work well in the first place).

r? @jieyouxu
Don't add empty target features for target-cpu=native on macOS

LLVM does not support host feature detection (only host cpu detection) on apple platforms. As such, the returned feature string will be empty. Adding this empty string to the target-features attribute results in a verifier error on LLVM 22.

Fix this by not adding the empty string to the target features. The reason why this was not caught by the target-cpu-native test is that it requires a function that adds *some* target features, otherwise the attribute is omitted entirely. We achieve this with a somewhat peculiar construction that enables `neon` if it's already enabled. (This is to avoid enabling it on softfloat targets.)

Fixes rust-lang/rust#153397.
Fix some comments about dataflow analysis.

Mostly in the examples in `initialized.rs`. In particular, the `EverInitializedPlaces` example currently doesn't cover how it's initialization sites that are tracked, rather than local variables (that's the `b_0`/`b_1` distinction in the example.)

r? @cjgillot
…t-pr, r=marcoieni

Fix LegacyKeyValueFormat report from docker build: pr

Part of rust-lang/rust#152305

r? @marcoieni
…r=nnethercote

fix(query): Pass Query Key to `value_from_cycle_error`

### Summary:

Pass the query key directly to `value_from_cycle_error` so that `FromCycleError` impls (notably `FnSig`) can use the recovered query's `DefId` instead of relying on `cycle[0]`, which is arbitrarily rotated by the parallel deadlock handler.

As suggested in [#153644 (comment)](rust-lang/rust#153644 (comment)).

Closes rust-lang/rust#153391

r? @nnethercote
cc @zetanumbers
…r=TaKO8Ki

unused_macro_rules switched used and unused comments

Incorrect swapping of "used" and "unused".

The lint example:
```rust
#[warn(unused_macro_rules)]
macro_rules! unused_empty {
    (hello) => { println!("Hello, world!") }; // This rule is unused
    () => { println!("empty") }; // This rule is used
}

fn main() {
    unused_empty!(hello);
}
```

It is clearly using the `(hello)` case. Yet it is labeled as "unused".
This PR fixed that small issue and corrects the mistake.
add test that an incomplete feature emits a warning

Related to rust-lang/compiler-team#974, this PR adds a new test to specifically check that a dummy incomplete feature triggers the `incomplete_features` lint. (since this seemed to be the favored approach on Zulip)

Alternative to rust-lang/rust#153706.

r? fmease
editorconfig: css uses tabs

Tidy enforces the fact that css files use tabs, but currently `.editorconfig` says everything that isn't llvm or a Makefile should always use spaces.  This PR makes it so all editors that honor `.editorconfig` will use the correct indentation for css files.
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to f6cc6f6.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
actually make the is-fn test test what it says it tests

r? @lcnr

Previously this test was (apart from the comment) identical to tests/ui/async-await/async-closures/once.rs
bors and others added 21 commits March 12, 2026 11:32
…uwer

Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#153726 (Add optional CI job to build the compiler with the parallel frontend)
 - rust-lang/rust#153763 (Don't add empty target features for target-cpu=native on macOS)
 - rust-lang/rust#153432 (Fix some comments about dataflow analysis.)
 - rust-lang/rust#153529 (Fix LegacyKeyValueFormat report from docker build: pr)
 - rust-lang/rust#153694 (fix(query): Pass Query Key to `value_from_cycle_error`)
 - rust-lang/rust#153717 (unused_macro_rules switched used and unused comments)
 - rust-lang/rust#153736 (add test that an incomplete feature emits a warning)
 - rust-lang/rust#153748 (editorconfig: css uses tabs)
 - rust-lang/rust#153750 (rustc-dev-guide subtree update)
 - rust-lang/rust#153762 (actually make the is-fn test test what it says it tests)
…=petrochenkov

Always generate generics in delegation that match trait in trait impl scenario

After rust-lang/rust#151864 there is a change in delegation code generation in `trait impl` cases: after rust-lang/rust#151864 we started to look at user-specified args and generate functions, whose generics may not match the signature of the function that is defined in trait. Such handling of delegation from trait impl is not correct, as the generated function should always have the same generics as its signature function in trait.

This addresses the "Fix generic params generation in trait impl case" future work from rust-lang/rust#151864

r? @petrochenkov
…lcnr

Detect existing turbofish on method calls to suppress useless suggestion

`expr_inferred_arg_iter` hardcoded `have_turbofish: false` for `MethodCall` expressions, while the `Path` case properly checked for existing type arguments via `segment.args`. This meant the "consider specifying the generic arguments" suggestion always fired on method calls, even when the user already had a turbofish, producing a suggestion that just rewrote user syntax into fully qualified form without resolving anything.

Fixes rust-lang/rust#153732.

cc @eggyal
Remove `MTLock`

This removes the `MTLock` type and replaces it users with the regular `Lock`. It no longer makes sense now that we don't have a compile-time toggle for parallelism.
Fix Hexagon ABI calling convention for small aggregates

Small structs (<= 64 bits) were being passed with their fields split into separate arguments instead of being packed into register-sized chunks. This caused ABI mismatches.

The fix properly casts small aggregates to consecutive register-sized chunks using Uniform::consecutive(), matching the Hexagon C ABI where small structs are packed into R1:0 register pair.

This fixes tests like extern-pass-TwoU16s.rs and extern-pass-TwoU8s.rs.
Fix that `./x test --no-doc` actually keeps the same behaviour for backwards compatability

In rust-lang/rust#153143 the `./x test --no-doc` flag was renamed to `--all-targets`.  I added a commit that keeps the `--no-doc` flag for backwards compatibility, but unfortunately I forgot to actually keep the behaviour the same, which is fixed by this PR.

r? @Kobzol
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#153705 (Always generate generics in delegation that match trait in trait impl scenario)
 - rust-lang/rust#153751 (Detect existing turbofish on method calls to suppress useless suggestion)
 - rust-lang/rust#153780 (Remove `MTLock`)
 - rust-lang/rust#151572 (Fix Hexagon ABI calling convention for small aggregates)
 - rust-lang/rust#153725 (Fix that `./x test --no-doc` actually keeps the same behaviour for backwards compatability)
…4, r=jieyouxu

Include optional `dso_local` marker for functions in `enum-[match,transparent-extract].rs`

This PR adds some more `dso_local` markers to the `enum-match.rs` and `enum-transparent-extract.rs` test annotations. These markers are added by LLVM when targeting `aarch64-unknown-none` even though they are missing in `aarch64-unknown-linux-gnu`. This is causing a CI error when running the codegen suite on the `aarch64-unknown-none` target for Ferrocene.

This is a follow up of rust-lang/rust#139891.
fixed VecDeque::splice() not filling the buffer correctly when resizing the buffer on start = end range

This PR fixes rust-lang/rust#151758. The issue came from `Splice::move_tail`, which as joboet pointed out:
> The issue is in move_tail, which resizes the buffer, but fails to account for the resulting hole.

The problem with reserving more space through `VecDeque`'s `buf.reserve()` is that it doesn't update `VecDeque`'s `head`, which means that this code in `move_tail`:
```rust
deque.wrap_copy(
    deque.to_physical_idx(tail_start),
    deque.to_physical_idx(new_tail_start),
    self.tail_len,
);
```
could move over the section of data that `tail_start..tail_start + self.tail_len` of the buffer is supposed to be held at to the incorrect destination since all `.to_physical_idx()` is doing is a wrapping add on the `VecDeque`'s head with the passed in `idx` value.

To avoid this I decided to use `VecDeque::reserve` to both allocate more space into the `VecDeque` if necessary and update head appropriately. However, `VecDeque::reserve` internally relies on the `VecDeque`'s `len` field. Earlier in `VecDeque::splice`, it modifies the `VecDeque`'s `len` constructing the drain via `Drain::new` (as it does a `mem::replace` on `deque.len` with the start bound of the passed in `range`). The `VecDeque`'s `len` can also be potentially modified in the earlier `Splice::fill()` call if it does any replacement towards elements within the passed in `range` value for `VecDeque::splice()`. I needed to temporarily restore the `VecDeque`'s `len` to its actual len, so that `VecDeque::reserve` can work properly. Afterward, you can bring back the `VecDeque`'s `len` to what its value was before and fill the gap appropriately with the rest of the `replace_with` content.

r? @joboet
Miscellaneous tweaks

A hodge-podge of small changes that didn't fit anywhere else.

r? @yaahc
…illot

`try_execute_query` tweaks

Details in individual commits.

r? @cjgillot
implementation of `-Z min-recursion-limit`

impl of rust-lang/compiler-team#969, closes rust-lang/rust#153132

r? lcnr
Avoid duplicated query modifier comments.

There is currently some duplication.
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#152258 (fixed VecDeque::splice() not filling the buffer correctly when resizing the buffer on start = end range)
 - rust-lang/rust#153691 (Miscellaneous tweaks)
 - rust-lang/rust#153766 (`try_execute_query` tweaks)
 - rust-lang/rust#153188 (implementation of `-Z min-recursion-limit`)
 - rust-lang/rust#153428 (Avoid duplicated query modifier comments.)
Update the minimum external LLVM to 21

With this change, we'll have stable support for LLVM 21 and 22.
For reference, the previous increase to LLVM 20 was rust-lang/rust#145071.

cc @rust-lang/wg-llvm
r? nikic
rustdoc-search: update to stringdex 0.0.6

This update includes a few optimizations that reduce the size and index building time:

- the wire format uses two bits to store four possibilities, instead of only handling three https://gitlab.com/notriddle/stringdex/-/merge_requests/34

- the hashes themselves are 40 bits instead of 48, and inlining is able to still fit enough data by storing runs https://gitlab.com/notriddle/stringdex/-/merge_requests/35

- scanning for duplicates takes advantage of the rarity of conflicts, using an array with 32 bit numbers and only pulling in the other 8 bits when actually needed https://gitlab.com/notriddle/stringdex/-/merge_requests/37
compiler-builtins subtree update

Subtree update of `compiler-builtins` to rust-lang/compiler-builtins@8173070.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
Tidy: disallow TODO in other in-tree projects

Fixes: rust-lang/rust#152280
MCP: rust-lang/compiler-team#963

TODO

* [x] Add ci check to `cg_clif`: rust-lang/rustc_codegen_cranelift#1632
* [x] Add ci check to `cg_gcc`: rust-lang/rustc_codegen_gcc#861

r? lcnr
This updates the rust-version file to 1e2183119f0ee19cc26df899e26b04ad0de3475d.
@rustbot
Copy link
Collaborator

rustbot commented Mar 16, 2026

Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using r? rustc-dev-guide or r? <username>.

@rustbot rustbot added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Mar 16, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 16, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@tshepang tshepang merged commit f1aa14d into main Mar 16, 2026
1 check passed
@rustbot rustbot removed the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants