Skip to content

Rustc pull update#2787

Merged
tshepang merged 25 commits intomainfrom
rustc-pull
Mar 2, 2026
Merged

Rustc pull update#2787
tshepang merged 25 commits intomainfrom
rustc-pull

Conversation

@workflows-rustc-dev-guide
Copy link

Latest update from rustc.

jdonszelmann and others added 25 commits February 24, 2026 12:03
…ulacrum

Neon fast path for str::contains

Using the SIMD friendly version of the function also gives a decent speed up with Neon.
std: move `exit` out of PAL

This PR moves `exit` out of `sys::pal` (as per rust-lang/rust#117276) and into a common module with `unique_thread_exit`.
…rcoieni

Skip `tidy` in PR CI jobs not dedicated to running `tidy`

This is both:

1. Redundant, since PR CI has a dedicated `tidy` job which runs in parallel and doesn't early-cancel other PR CI jobs
2. A contributor roadblock, because tidy failures in one test jobs block further failures from other test jobs being revealed.

(2) defeats the parallel-but-not-early-cancelling reason of the separate `tidy` job in the first place.

This PR skips tidy from being run in PR CI jobs that are not dedicated to running `tidy` (i.e. the non-`tidy` CI jobs).

Fixes rust-lang/rust#148932.
Add optional json logging

I became slightly frustrated with rust's logging output, and wanted to experiment a little with slightly postprocessing it with custom scripts. I think this is a pretty uninteresting change otherwise, shouldn't affect anyone else nor bother anyone. It's small enough that we can remove it again, nor is any of this stable or expected to be.

r? @jieyouxu
Remove `rustc_feedable_queries` and `define_feedable` macros.

The can be folded into `rustc_with_all_queries` and `define_callbacks`. Details in individual commits.

r? @oli-obk
…,jonathanbrouwer

Port diagnostic attributes

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/151558)*

Ports all the diagnostic attributes: on_const, on_unimplemented and rustc_on_unimplemented.

I thought about migrating them one by one but that would leave a lot of code duplicated. So this PR looks big but it's mostly a lot of moving code around with slight modifications.

r? @JonathanBrouwer

cc @jdonszelmann feel free to review if you want, not sure which of you wants it.
mGCA: Enforce WF element types for array valtrees

Fixes rust-lang/rust#152125

Extends WellFormedness checking for const generics to validate that array element types in ValTrees match the declared element type.

### Problem
Before commit, this would have incorrectly compiled

``` rust
#![feature(adt_const_params, min_generic_const_args)]

use std::marker::ConstParamTy;

#[derive(Eq, PartialEq, ConstParamTy)]
struct Foo;

struct Bar;

fn foo<const N: [Foo; 1]>() {}

fn main() {
    foo::<{ [Bar] }>();
}
```

### Solution
Added a `ty::Array` arm to checking WellFormedness (similar to the existing `ty::Tuple` arm from rust-lang/rust#150713) which creates `ConstArgHasType` obligations for each array element, ensuring they match the array's declared element type.

I attempted to combine the `Tuple` and `Array` arms into a single arm, but this proved difficult due to pattern matching limitations, and the separate arm is more readable anyway.

### Tests

Added UI test which verifies that the type mismatch is now properly caught, and also returns an appropriate test message

r? @BoxyUwU
Fix async drop glue MIR bug

Attempted to fix rust-lang/rust#142560
Relevant Zulip (where I talk a lot more about what I did): [#wg-async > is there a way I can help with Async Drop?](https://rust-lang.zulipchat.com/#narrow/channel/187312-wg-async/topic/is.20there.20a.20way.20I.20can.20help.20with.20Async.20Drop.3F/with/572847292)
…zelmann

`unused_must_use` lint improvements

The main purpose of this is to allow clippy to use `is_ty_must_use` from rustc, rather than making their own (outdated) copy. This also adds changes from rust-lang/rust#148214 under a function flag, so clippy can start linting with the new semantics in mind, while rustc doesn't yet (see rust-lang/rust#148214 (comment)).

I've also done some refactoring while I was at it.

r? @jdonszelmann
Update books

## rust-embedded/book

1 commits in fe88fbb68391a465680dd91109f0a151a1676f3e..99d0341ff4e06757490af8fceee790c4ede50bc0
2026-02-11 12:58:13 UTC to 2026-02-11 12:58:13 UTC

- Remove triagebot.toml (rust-embedded/book#405)

## rust-lang/reference

21 commits in addd0602c819b6526b9cc97653b0fadca395528c..442cbef9105662887d5eae2882ca551f3726bf28
2026-02-22 02:55:12 UTC to 2026-02-11 01:41:05 UTC

- Document importing path-segment keyword (rust-lang/reference#2136)
- avoid needless dereference (rust-lang/reference#2180)
- Use `clobber_abi`s corresponding to the called functions in `[asm.abi-clobbers.many]`'s example. (rust-lang/reference#2170)
- expr.paren.evaluation: fix and make more simple (rust-lang/reference#2158)
- const-eval.const-context.outer-generics: make more clear/obvious (rust-lang/reference#2159)
- Nightly test links: update rust branch name (use `main`) (rust-lang/reference#2185)
- tools/xtask: update rust branch name for linkcheck script (use `main`) (rust-lang/reference#2184)
- specify `if let` guards with updated scoping rules (rust-lang/reference#1957)
- Document assignment expression as coercion site (rust-lang/reference#1954)
- Remove exception WRT same-crate `non_exhaustive` reads (rust-lang/reference#2162)
- Add negative lookahead (rust-lang/reference#2172)
- Switch to new range syntax (rust-lang/reference#2173)
- add mdbook output for dev-guide to ignore file (rust-lang/reference#2178)
- Fix rule name for while syntax (rust-lang/reference#2175)
- block-expr: add new rule expr.block.result-value (rust-lang/reference#2174)
- lifetime-elision.md: add some missing periods (rust-lang/reference#2176)
- Add cut operator (`^`) to grammar (rust-lang/reference#2104)
- dev-guide stabilization.md: add missing "not" (rust-lang/reference#2167)
- Add method call and await expr for Dot in syntax index (rust-lang/reference#2163)
- Fix sort of punctuation list (rust-lang/reference#2161)
- Add a contributor guide (rust-lang/reference#2097)

## rust-lang/rust-by-example

1 commits in bac931ef1673af63fb60c3d691633034713cca20..5383db524711c0c9c43c3ca9e5e706089672ed6a
2026-02-16 12:02:33 UTC to 2026-02-16 12:02:33 UTC

- 1.2.2 Display: Fix typo in bonus instructions (before -> after) (rust-lang/rust-by-example#1998)
Clarify how "ensure" queries check whether they can skip execution

The current `check_cache: bool` field in QueryMode is confusing for a few reasons:

- It actually refers to checking the *disk cache*, not the in-memory cache.
- It gives no indication of what condition is being checked, or why.
- It obscures the link between `tcx.ensure_ok()` and `tcx.ensure_done()`, and the actual check.

This PR replaces that field with an `EnsureMode` enum that distinguishes between ensure-ok and ensure-done, and leaves the actual check as an implementation detail of the ensure-done mode.

This PR also renames `ensure_must_run` → `check_if_ensure_can_skip_execution`, and uses a return struct to more clearly indicate how this helper function gives permission for its caller to skip execution of a query that would otherwise be executed. This also inverts the sense of the returned boolean, which was previously “must run” but is now ”skip execution”.

r? nnethercote (or compiler)
fix error on missing value for -C flags

Before:
```
error: codegen option `panic` requires either `unwind`, `abort`, or `immediate-abort` (C panic=<value>)
```
After:
```
error: codegen option `panic` requires either `unwind`, `abort`, or `immediate-abort` (`-C panic=<value>`)
```

The second commit renames a field in the options macro for better consistency; that did not seem worth its own PR.
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 38b9dd2.

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

r? @ghost
…uwer

Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#152176 (Neon fast path for str::contains)
 - rust-lang/rust#152657 (std: move `exit` out of PAL)
 - rust-lang/rust#152841 (Streamline `QueryVTableUnerased` into `GetQueryVTable`)
 - rust-lang/rust#152845 (Skip `tidy` in PR CI jobs not dedicated to running `tidy`)
 - rust-lang/rust#152897 (Add optional json logging)
 - rust-lang/rust#153009 (Remove `rustc_feedable_queries` and `define_feedable` macros.)
 - rust-lang/rust#151558 (Port diagnostic attributes)
 - rust-lang/rust#152492 (mGCA: Enforce WF element types for array valtrees)
 - rust-lang/rust#152888 (Fix async drop glue MIR bug)
 - rust-lang/rust#152988 (Port `#[register_tool]` to the new attribute system)
 - rust-lang/rust#153018 (`unused_must_use` lint improvements)
 - rust-lang/rust#153023 (Update books)
 - rust-lang/rust#153033 (Clarify how "ensure" queries check whether they can skip execution)
 - rust-lang/rust#153043 (fix error on missing value for -C flags)
 - rust-lang/rust#153045 (rustc-dev-guide subtree update)

Failed merges:

 - rust-lang/rust#153032 (Fix attribute parser and kind names.)
…=estebank

Try to recover from over-parsing in const item with missing semicolon

Fixes rust-lang/rust#151149

r? @estebank
Prepare NonNull for pattern types



Pull out the changes that affect some tests, but do not require pattern types.

See rust-lang/rust#136006 (comment) for what triggered this PR

r? @scottmcm
pre-intern single-letter `sym::[a-zA-Z]`

As suggested in rust-lang/rust#152624 (comment).

Needs a perf run I guess.
…xyUwU

refactor(mgca): Change `DefKind::Const` and `DefKind::AssocConst` to have a `is_type_const` flag



Addresses rust-lang/rust#152940 

- Changed `DefKind::Const` and `DefKind::AssocConst` to have a `is_type_const` flag.
- changed `is_type_const` query to check for this flag
- removed `is_rhs_type_const` query

r? @BoxyUwU
…=RalfJung

perf(codegen): Restore `noundef` On `PassMode::Cast` Args In Rust ABI



### Summary:

#### Problem:

Small aggregate arguments passed via `PassMode::Cast` in the Rust ABI (e.g. `[u32; 2]` cast to `i64`) are missing `noundef` in the emitted LLVM IR, even when the type contains no uninit bytes:

```rust
#[no_mangle]
pub fn f(v: [u32; 2]) -> u32 { v[0] }
```

```llvm
; expected: define i32 @f(i64 noundef %0)
; actual:   define i32 @f(i64 %0)           ← noundef missing
```

This blocks LLVM from applying optimizations that require value-defined semantics on function arguments.

#### Root Cause:

`adjust_for_rust_abi` calls `arg.cast_to(Reg::Integer)`, which internally creates a `CastTarget` with `ArgAttributes::new()` — always empty. Any validity attribute that was present before the cast is silently dropped.

This affects all `PassMode::Cast` arguments and return values in the Rust ABI: plain arrays, newtype wrappers, and any `BackendRepr::Memory` type small enough to fit in a register.

A prior attempt (rust-lang/rust#127210) used `Ty`/`repr` attributes to detect padding.

#### Solution:

After `adjust_for_rust_abi`, iterate all `PassMode::Cast` args and the return value. For each, call `layout_is_noundef` on the original layout; if it returns `true`, set `NoUndef` on the `CastTarget`'s `attrs`.

`layout_is_noundef` uses only the computed layout — `BackendRepr`, `FieldsShape`, `Variants`, `Scalar::is_uninit_valid()` — and never touches `Ty` or repr attributes. **Anything it cannot prove returns `false`.**

Covered cases:
- `Scalar` / `ScalarPair` (both halves initialized, fields contiguous)
- `FieldsShape::Array` (element type recursively uninit-free)
- `FieldsShape::Arbitrary` with `Variants::Single` (fields cover `0..size` with no gaps, each recursively uninit-free) — handles newtype wrappers, multi-field structs, single-variant enums, `repr(transparent)`, `repr(C)` wrappers

Conservatively excluded with FIXMEs:
- Multi-variant enums (per-variant padding analysis needed)
- Foreign-ABI casts (cast target may exceed layout size, needs a size guard)

### Changes:

- `compiler/rustc_ty_utils/src/abi.rs`: add restoration loop after `adjust_for_rust_abi`; add `layout_is_noundef` and `fields_cover_layout`.
- `tests/codegen-llvm/abi-noundef-cast.rs`: new FileCheck test covering arrays, newtype wrappers (`repr(Rust)`, `repr(transparent)`, `repr(C)`), multi-field structs, single-variant enums, return values, and negative cases (`MaybeUninit`, struct with trailing padding).
- `tests/codegen-llvm/debuginfo-dse.rs`: update one CHECK pattern — `Aggregate_4xi8` (`struct { i8, i8, i8, i8 }`) now correctly gets `noundef`.

Fixes rust-lang/rust#123183.

r? @RalfJung
This updates the rust-version file to e7d90c695a39426baf5ae705de2f9570a72229de.
@rustbot
Copy link
Collaborator

rustbot commented Mar 2, 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 2, 2026
@tshepang tshepang merged commit 23e8254 into main Mar 2, 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 2, 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.

5 participants