Rollup of 5 pull requests
Successful merges:
- rust-lang/rust#156338 (Implement derives for Reborrow and CoerceShared)
- rust-lang/rust#158083 (Fix perf regression in `Read::read_to_end` on short reads due to not checking if the cursor has initialized bytes)
- rust-lang/rust#160829 (bootstrap: Make `main.rs` a stub that calls into the library crate)
- rust-lang/rust#159839 (point at closure return expression in non-`FnOnce` E0271 errors)
- rust-lang/rust#160775 (interpret: treat pattern and unsafe-binder as ABI-transparent)
point at closure return expression in non-`FnOnce` E0271 errors
when a closure literal is passed as a function argument and E0271 fires for a projection that isnt `FnOnceOutput`. the error now points at the closures return expression and labels the closure declaration with "this closure". mirroring the existing FnOnce handling in `maybe_detailed_projection_msg`. which cant recover the closure from `self_ty` alone.
fixes https://github.com/rust-lang/rust/issues/42390
r? @estebank
bootstrap: Make `main.rs` a stub that calls into the library crate
As with some other bootstrap tools (e.g. compiletest), bootstrap itself is built as a small binary crate (executable) that links to a larger library crate.
If there is non-trivial code in `main.rs`, then any items it touches need to be publicly exported from the library crate. Those public exports make it harder to identify unused code within bootstrap.
As far as I can tell, there is no compelling rule or principle that determines whether code should be in the entry point or in the library crate, other than historical inertia.
This PR therefore takes all of the code from `main.rs`, and moves it into a new file `cli_main.rs` within the bootstrap library crate. That avoids the need for any public exports other than `cli_main::main` itself.
There should be no change to bootstrap behaviour.
---
This change makes it possible to change all of bootstrap's `pub` items to `pub(crate)`. That migration is left to a future PR, as it involves a fair bit of churn, and requires decisions on how to deal with pub items that are currently unused.
Prior art:
- https://github.com/rust-lang/rust/pull/147506
Fix perf regression in `Read::read_to_end` on short reads due to not checking if the cursor has initialized bytes
This PR fixesrust-lang/rust#158008.
In particular, in rust-lang/rust#150129, it refactored some code within `library/std/io/mod.rs` to utilize `BorrowedBuf::is_init` instead of manually checking `read_buf.init_len() == buf_len` to see if the read buffer had initialized bytes. However, the `BorrowedBuf` is never marked or set as init within this function, and I think this portion of the code:
```rust
// SAFETY: These bytes were initialized but not filled in the previous loop
unsafe {
read_buf.set_init(initialized);
}
```
was removed by mistake. This PR reverts the changes made by rust-lang/rust#150129, so that we can mark the `BorrowedBuf`/`read_buf` as initialized using `BorrowedBuf::set_init` if in a previous iteration the cursor has initialized bytes. This would allow `max_read_size` to not be marked as `usize::max` if the read buffer contains initialized bytes.
Closes: rust-lang/rust#142872
Implement derives for Reborrow and CoerceShared
This adds built-in derive support for the experimental `Reborrow` and `CoerceShared` marker traits behind `#![feature(reborrow)]`.
The derives generate the same marker impls users would write manually, while preserving the existing coherence and structural validation path for the experimental reborrow traits.
## Please note this impl:
- Preserves generics, lifetimes, const params, and where clauses in generated impls.
- Preserves multiple lifetime parameters in generated impls instead of duplicating the current experimental one-lifetime limitation in the derive layer.
- Requires an explicit `CoerceShared` target type through the derive helper attribute.
- Adds UI coverage for valid derives, feature gating, malformed helper attributes, unsupported item kinds, validation failures, and multiple-lifetime derive behavior.
- Makes the derive layer future-proof for multiple lifetimes: it preserves all lifetime parameters and generates the same impl shape as a manual impl.
@rustbot label F-reborrow
Tracking: https://github.com/rust-lang/rust/issues/145612
Switch try jobs to c8a.8xlarge
This also expands the instance type list. Our current selection (12xlarge) is at best 2-3 minutes faster than 8xlarge based on rough benchmarks, which isn't worth the extra ~$0.72/build. See description of https://github.com/rust-lang/simpleinfra/issues/1132 for those results.
We expand the instance list to include even smaller instances because we might experiment with using those smaller instances for non-try jobs (e.g., auto and unrolled perf builds) because latency matters less there. That's not done in this commit though.
Unfortunately I think we cannot easily test this before landing it, since AFAICT bors will read the configuration only once it's actually on main. https://github.com/rust-lang/bors-kindergarten/pull/59 (once merged) should give us some test experience with this before we proceed with things in rust-lang/rust.
r? Kobzol
Implement <OnceCell,OnceLock>::new_init
Tracking issues: rust-lang/rust#159859rust-lang/rust#159860
I'm not sure If I was supposed to add any other tests apart from the doc tests.
Update books
## rust-lang/reference
9 commits in afdc77bab886d4455c11247cdd32391bfab636ae..82da570bafd9efed421bdbae0f8603ede8dd308b
2026-08-08 22:04:17 UTC to 2026-07-28 18:20:15 UTC
- add c-variadic function definitions (rust-lang/reference#2177)
- Update `no_mangle` to use the attribute template (rust-lang/reference#1904)
- enums with fields: clarify that repr(C, int) is quite different from repr(int) (rust-lang/reference#2227)
- aliasing rules also apply inside private fields (rust-lang/reference#2304)
- attributes: do not explain syntax in rules (rust-lang/reference#2306)
- Document prohibition on inner attribute macros (rust-lang/reference#2311)
- Use authentication for linkcheck (rust-lang/reference#2319)
- Stabilize passing 128-bit integers via vector registers with `asm!` on x86 (rust-lang/reference#2313)
- Add a rule for attribute macro outline modules (rust-lang/reference#2310)
Overhaul `rustc_query_impl`
The file/module structure is all over the place. In particular, `plumbing.rs` and `query_impl.rs` are pretty meaningless file names.
r? @Zalathar
core: generalize `BorrowedCursor::ensure_init`
Tracking issue: https://github.com/rust-lang/rust/issues/160476
This implements the future possibility left out in https://github.com/rust-lang/rust/pull/149749#issue-3704149674 and makes `ensure_init` generic over `Default`. I used specialisation to make sure the performance in the `u8` case stays equivalent to `memset` irrespective of how clever the optimiser happens to be.
CC @joshtriplett as you've been working on this stuff recently.
This also adds a public `write_default` method on `[MaybeUninit<T>]` that's doing the equivalent of `.write_init(|_| Default::default())`, but uses specialisation for integers. This uses the existing [tracking issue for `maybe_uninit_fill`](https://github.com/rust-lang/rust/issues/117428).
Add back homu-ignore markers around the PR template
Besides reinstantiating the `homu-ignore` markers from rust-lang/rust#126501, this PR also adds better clarification how the homu-ignore markers actually work; I've then also moved that section further down as it seems less important than the other parts of the PR template message. (We shouldn't forget that this is a *general PR template message*, not a LLM-policy-specific message.)
The disclosure markers appear to have been accidentally removed together with the checkboxes in rust-lang/rust#160785.
In the future, if support for ignoring HTML comments in places such as markdown code blocks was added, the new description about how `<!-- homu-ignore:end -->`/`<!-- homu-ignore:start -->` can be used could be further simplified[^1], but I'd like to address the immediate issues first before considering any more involved improvements (there already *exist* [currently ~~6~~ 8] new PRs now that contain the whole template comment without `homu-ignore` markers).
[^1]: actually it may always stay non-ideal given that HTML comments don't nest 🫠
These four functions are all only used within `execution.rs`, so they no
longer need `pub(crate)`.
This is the first step toward eliminating `plumbing.rs`.
`lib.rs` imports `DepNode`/`DepNodeIndex` even though it doesn't use
them directly. And then `execution.rs` uses that one. Weird.
This commit fixes things to be more normal.
If there is non-trivial code in `main.rs`, then any items it touches need to be
publicly exported from the library crate. Those public exports make it harder
to identify unused code within bootstrap.
Rollup of 7 pull requests
Successful merges:
- rust-lang/rust#160629 ([Priroda] Add bootstrap test and check steps)
- rust-lang/rust#160811 (Fix `visible_parent_map` fallback map merging perf regression)
- rust-lang/rust#154329 (Diagnostics ICE when replaying proof trees with next-solver)
- rust-lang/rust#157841 (Ensure inferred let pattern types are well-formed)
- rust-lang/rust#159300 (Implement `to_string()` on `ByteStr` and `ByteString`)
- rust-lang/rust#160858 (Add regression test for assoc const panic ICE in match)
- rust-lang/rust#160864 (Rename `HostEffectPredicate` to `HostEffectClause`)
Optimize new solver unification table ops
The current code uses the `ena` crate in sub-optimal ways. Improving this gives big speed wins for the new trait solver on some benchmarks. Details in individual commits.
r? @lcnr
Add regression test for assoc const panic ICE in match
Closesrust-lang/rust#91514, The associated const panic!() in a match used to ICE and now fails const eval cleanly
Diagnostics ICE when replaying proof trees with next-solver
When diagnostics replay proof tree state, rebuilding a canonical state can fail to match the current inference state. With -Znext-solver=globally, this could panic while reporting an error, avoiding the panic.
Make proof tree replay fallible in diagnostics and fall back to the current obligation when replay fails. Add a regression test for the higher-ranked PartialEq and PartialOrd case. Fixesrust-lang/rust#151304.
Fix `visible_parent_map` fallback map merging perf regression
This PR attempts to fix the `visible_parent_map` perf regression introduced in rust-lang/rust#160464, which was found in a [post-merge perf run](https://github.com/rust-lang/rust/pull/160464#issuecomment-5231136940).
Because the original PR fixes unnecessary iterations in the breadth-first search (BFS), meaning that it only reduces the amount of work during the BFS, the likely cause of the perf regression is the changed merging of the fallback map into the final visible parent map after the BFS.
The goal of this PR is to determine whether this is the case through a perf try run. The change itself works around the Unord* APIs, but might be worth it to work around the perf regression.
[Priroda] Add bootstrap test and check steps
The priroda crate lives under src/tools/miri/priroda and shares miri's sysroot and toolchain setup, so register a test step that mirrors the existing miri one and a check step alongside cargo-miri.
r? oli-obk
Add an inherent `to_string()` method to `ByteStr` and `ByteString` that returns
`Result<String, Utf8Error>`, overriding the `to_string()` method made available
by the blanket implementation of `ToString` for all types that implement
`Display`.
Gate the new `to_string()` methods, and the existing `Display` implementations,
behind a new feature flag, `bstr_to_string`.