Skip to content

Conversation

@workflows-rustc-dev-guide
Copy link

Latest update from rustc.

Zalathar and others added 30 commits November 3, 2025 11:52
Provide additional context to errors involving const traits

When encountering an unmet `Ty: [const] Trait` bound, if `Trait` is `#[const_trait]` and there's an `impl Trait for Ty` point at it. If local, suggest `impl const Trait for Ty`, otherwise just point at it.

```
error[E0277]: the trait bound `NonConstAdd: [const] Add` is not satisfied
  --> $DIR/assoc-type.rs:37:16
   |
LL |     type Bar = NonConstAdd;
   |                ^^^^^^^^^^^
   |
note: required by a bound in `Foo::Bar`
  --> $DIR/assoc-type.rs:33:15
   |
LL |     type Bar: [const] Add;
   |               ^^^^^^^^^^^ required by this bound in `Foo::Bar`
help: make the `impl` of trait `Add` `const`
   |
LL | impl const Add for NonConstAdd {
   |      +++++
```
```
error[E0277]: the trait bound `T: [const] PartialEq` is not satisfied
    --> tests/ui/traits/const-traits/call-generic-method-fail.rs:5:5
     |
5    |     *t == *t
     |     ^^^^^^^^
     |
note: trait `PartialEq` is implemented but not `const`
    --> /home/gh-estebank/rust/library/core/src/ptr/const_ptr.rs:1590:1
     |
1590 | impl<T: PointeeSized> PartialEq for *const T {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: trait `PartialEq` is implemented but not `const`
    --> /home/gh-estebank/rust/library/core/src/ptr/mut_ptr.rs:2011:1
     |
2011 | impl<T: PointeeSized> PartialEq for *mut T {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
ci: add runners for vanilla LLVM 21

Ubuntu 25.10 has `llvm-21` packages that we can test with.
The `Dockerfile` is otherwise the same as the `llvm-20` runners.
rustc_codegen: fix musttail returns for cast/indirect ABIs

Fixes rust-lang/rust#148239 rust-lang/rust#144986

Explicit tail calls trigger `bug!` for any callee whose ABI returns via `PassMode::Cast`, and we forgot to to forward the hidden `sret` out-pointer when the ABI requested an indirect return. The former causes ICE, the latter produced malformed IR (wrong codegen) if the return value is large enough to need `sret`.

Updated the musttail helper to accept cast-mode returns, made it so that we pass the return pointer through the tail-call path.

Added two UI tests to demonstrate each case.

This is my first time contributing, please do check if I did it right.

r? theemathas
…eLapkin

Remove a special case and move another one out of reachable_non_generics

One is no longer necessary, the other is best placed in cg_llvm as it works around a cg_llvm bug.
Point at inner item when it uses generic type param from outer item or `Self`

Partially address rust-lang/rust#37892.

In E0401 generated in resolve:
```
error[E0401]: can't use generic parameters from outer item
  --> $DIR/E0401.rs:4:39
   |
LL | fn foo<T>(x: T) {
   |        - type parameter from outer item
LL |     fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
   |        ----                           ^ use of generic parameter from outer item
   |        |
   |        generic parameter used in this inner function
   |
help: try introducing a local generic parameter here
   |
LL |     fn bfnr<T, U, V: Baz<U>, W: Fn()>(y: T) {
   |             ++
```
In E0401 generated in hir_typeck:
```
error[E0401]: can't reference `Self` constructor from outer item
  --> $DIR/do-not-ice-on-note_and_explain.rs:6:13
   |
LL | impl<B> A<B> {
   | ------------ the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference
LL |     fn d() {
LL |         fn d() {
   |            - `Self` used in this inner item
LL |             Self(1)
   |             ^^^^ help: replace `Self` with the actual type: `A`
```
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#144194 (Provide additional context to errors involving const traits)
 - rust-lang/rust#148232 (ci: add runners for vanilla LLVM 21)
 - rust-lang/rust#148240 (rustc_codegen: fix musttail returns for cast/indirect ABIs)
 - rust-lang/rust#148247 (Remove a special case and move another one out of reachable_non_generics)
 - rust-lang/rust#148370 (Point at inner item when it uses generic type param from outer item or `Self`)

r? `@ghost`
`@rustbot` modify labels: rollup
tests: activate misspelled `gdb-check` in `function-arg-initialization.rs`

In 9253e1206e91f5bd7 a bunch of `gdbr-check` (for `rust-gdb`) directives and `gdbg-check` (for plain `gdb`) directives were added. But in two places the author accidentally wrote `gdbt-check` instead (`t` is next to `r` on the keyboard). This commit fixes that typo.

rust-lang/rust#129218 later renamed `gdbr-check` to just `gdb-check` which is why we rename to `gdb-check` directly.

The test still passes locally for me after the change, but fails if I change the `gdb-check` checks to check for some other string, so the check seems to still perform its intended function.

Note that we need to add a `std::hint::black_box()` to avoid

    $4 = <optimized out>

prints on at least `aarch64-gnu-llvm-20-1`.

After this there are no more instances of the string `gdbt` in the code base:
```console
$ git grep gdbt
```

try-job: dist-i586-gnu-i586-i686-musl
…ouwer,davidtwco

Add LLVM range attributes to slice length parameters

It'll take a bunch more work to do this in layout -- because of cycles in `struct Foo<'a>(&'a Foo<'a>);` -- so until we figure out how to do that well, just look for slices specifically and add the proper range for the length.
Tweak output of missing lifetime on associated type

Follow up to rust-lang/rust#135602.

Previously we only showed the trait's assoc item if the trait was local, because we were looking for a small span only for the generics, which we don't have for foreign traits. We now use `def_span` for the item, so we at least provide some context, even if its span is too wide.

```
error[E0195]: lifetime parameters or bounds on type `IntoIter` do not match the trait declaration
   --> tests/ui/lifetimes/missing-lifetime-in-assoc-type-4.rs:7:18
    |
7   |     type IntoIter<'a> = std::collections::btree_map::Values<'a, i32, T>;
    |                  ^^^^ lifetimes do not match type in trait
    |
   ::: /home/gh-estebank/rust/library/core/src/iter/traits/collect.rs:292:5
    |
292 |     type IntoIter: Iterator<Item = Self::Item>;
    |     ------------------------------------------ lifetimes in impl do not match this type in trait
```

Given an associated item that needs a named lifetime, look at the enclosing `impl` item for one. If there is none, look at the self type and the implemented trait to see if either of those has an anonimous lifetime. If so, suggest adding a named lifetime.

```
error: in the trait associated type is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type
  --> $DIR/missing-lifetime-in-assoc-type-2.rs:5:17
   |
LL |     type Item = &T;
   |                 ^ this lifetime must come from the implemented type
   |
help: add a lifetime to the impl block and use it in the self type and associated type
   |
LL ~ impl<'a> IntoIterator for &'a S {
LL ~     type Item = &'a T;
   |
```

Move the previous long message to a note and use a shorter primary message:

```
error: missing lifetime in associated type
  --> $DIR/missing-lifetime-in-assoc-type-1.rs:9:17
   |
LL | impl<'a> IntoIterator for &S {
   |     ---- there is a named lifetime specified on the impl block you could use
...
LL |     type Item = &T;
   |                 ^ this lifetime must come from the implemented type
   |
note: in the trait the associated type is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type
  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
help: consider using the lifetime from the impl block
   |
LL |     type Item = &'a T;
   |                  ++
```

r? `@Nadrieril`
Fix tests for big-endian

The tests fail on s390x and presumably other big-endian systems, due to check of raw alloc values in the MIR output.

To fix the tests remove the raw bytes from the MIR output (via: compile-flags: -Zdump-mir-exclude-alloc-bytes) and update the matching diffs.
compiler: Fix a couple issues around cargo feature unification

cc rust-lang/rust#148266. this doesn't fix all the issues (`rustc_public` and `rustc_transmute` still emit warnings when tested individually), but it fixes all the simple ones.

To fix rustc_public I will probably need help from ````@AlexanderPortland```` or ````@makai410```` to make sure I am not accidentally cfg-ing out items that are meant to be public. To fix `rustc_transmute`, I will need to know (from ````@jswrenn```` ?) in what context the `rustc` cargo feature is disapled. To reproduce the issues, you can run `x test rustc_{transmute,public}` locally.

---

The first issue I fixed was a warning in `rustc_index`:
```
Testing stage2 {rustc_parse_format} (aarch64-apple-darwin)
   Compiling rustc_index v0.0.0 (/Users/ci/project/compiler/rustc_index)
error: extern crate `smallvec` is unused in crate `rustc_index`
 --> compiler/rustc_index/src/lib.rs:2:1
  |
2 | #![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))]
  | ^
  |
  = help: remove the dependency or add `use smallvec as _;` to the crate root
  = note: `-D unused-crate-dependencies` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_crate_dependencies)]`

error: could not compile `rustc_index` (lib) due to 1 previous error
```

The second was that `type_ir_macros` didn't fully specify its dependencies:
```
Testing stage1 {rustc_type_ir_macros} (aarch64-apple-darwin)
   Compiling rustc_type_ir_macros v0.0.0 (/Users/jyn/src/ferrocene3/compiler/rustc_type_ir_macros)
error[E0432]: unresolved import `syn::visit_mut`
   --> compiler/rustc_type_ir_macros/src/lib.rs:2:10
    |
  2 | use syn::visit_mut::VisitMut;
    |          ^^^^^^^^^ could not find `visit_mut` in `syn`
    |
note: found an item that was configured out
   --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/syn-2.0.106/src/lib.rs:880:21
    |
878 | #[cfg(feature = "visit-mut")]
    |       --------------------- the item is gated behind the `visit-mut` feature
879 | #[cfg_attr(docsrs, doc(cfg(feature = "visit-mut")))]
880 | pub use crate::gen::visit_mut;
    |                     ^^^^^^^^^

error[E0433]: failed to resolve: could not find `visit_mut` in `syn`
   --> compiler/rustc_type_ir_macros/src/lib.rs:206:18
    |
206 |             syn::visit_mut::visit_type_path_mut(self, i);
    |                  ^^^^^^^^^ could not find `visit_mut` in `syn`
    |
note: found an item that was configured out
   --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/syn-2.0.106/src/lib.rs:880:21
    |
878 | #[cfg(feature = "visit-mut")]
    |       --------------------- the item is gated behind the `visit-mut` feature
879 | #[cfg_attr(docsrs, doc(cfg(feature = "visit-mut")))]
880 | pub use crate::gen::visit_mut;
    |                     ^^^^^^^^^
```
Implement Path::is_empty

This implements `Path::is_empty` which is simply a convenience wrapper for `path.as_os_str().is_empty()`.

Tracking issue: rust-lang/rust#148494
ACP: rust-lang/libs-team#687
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 1a96e5e.

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

r? `@ghost`
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147355 (Add alignment parameter to `simd_masked_{load,store}`)
 - rust-lang/rust#147925 (Fix tests for big-endian)
 - rust-lang/rust#148341 (compiler: Fix a couple issues around cargo feature unification)
 - rust-lang/rust#148371 (Dogfood `trim_{suffix|prefix}` in compiler)
 - rust-lang/rust#148495 (Implement Path::is_empty)
 - rust-lang/rust#148502 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
Relax r29 inline asm restriction on PowerPC64 targets

LLVM uses r29 to hold a base pointer for some PowerPC target configurations. It is usable on all 64 bit targets as a callee save register.

r? `@Amanieu`
…=WaffleLapkin

Move warning reporting from flag_to_backend_features to cfg_target_feature

This way warnings are emitted even in a check build.
Liveness: Cache the set of string constants for suggestions.

Even on a slow diagnostic path, listing all the constants in MIR can be expensive, so cache it.
ci: Switch back to default coreutils (uutils) after libffi-sys bump

Now that Miri has updated to the latest `libffi-sys`, we should be able to remove the GNU coreutils workaround, and switch back to the default coreutils (uutils) in the runners using Ubuntu 25.10 images.

If we encounter any other uutils compatibility problems in the future, they should hopefully be easier to trace back to specific changes.

- rust-lang/rust#147581
- rust-lang/miri#4634
- rust-lang/rust#147744

Closes rust-lang/rust#147556.
Update memchr to 2.7.6

memchr 2.7.6 contains a bugfix for aarch64_be.

Note: I'm not sure about how dependency updates are managed in rust.git. If something should go through another branch or will happen automatically, please let me know.
Add LLVM realtime sanitizer

This is a new attempt at adding the [LLVM real-time sanitizer](https://clang.llvm.org/docs/RealtimeSanitizer.html) to rust.

Previously this was attempted in rust-lang/rfcs#3766.

Since then the `sanitize` attribute was introduced in rust-lang/rust#142681 and it is a lot more flexible than the old `no_santize` attribute. This allows adding real-time sanitizer without the need for a new attribute, like it was proposed in the RFC. Because i only add a new value to a existing command line flag and to a attribute i don't think an MCP is necessary.

Currently real-time santizer is usable in rust code with the [rtsan-standalone](https://crates.io/crates/rtsan-standalone) crate. This downloads or builds the sanitizer runtime and then links it into the rust binary.

The first commit adds support for more detailed sanitizer information.
The second commit then actually adds real-time sanitizer.
The third adds a warning against using real-time sanitizer with async functions, cloures and blocks because it doesn't behave as expected when used with async functions. I am not sure if this is actually wanted, so i kept it in a seperate commit.
The fourth commit adds the documentation for real-time sanitizer.
…rk-Simulacrum

std_detect: Support run-time detection on OpenBSD using elf_aux_info
update isolate_highest_one for NonZero<T>

## Rationale
Let `x = self` and
`m = (((1 as $Int) << (<$Int>::BITS - 1)).wrapping_shr(self.leading_zeros()))`
Then the previous code computed `NonZero::new_unchecked(x & m)`.
Since `m` has exactly one bit set (the most significant 1-bit of `x`), `(x & m) == m`.
Therefore, the masking step was redundant.

The shift is safe and does not need wrapping because:
* `self.leading_zeros() < $Int::BITS` because `self` is non-zero.
* The result of `unchecked_shr` is non-zero, satisfying the `NonZero` invariant. if wrapping happens we would be violating `NonZero` invariants.

why this micro optimization?
the old code was suboptimal it duplicated `$Int`’s isolate_highest_one logic instead of delegating to it. Since the type already wraps `$Int`, either delegation should be used for clarity or, if keeping a custom implementation, it should be optimized as above.
…eGomez

rustdoc: Properly highlight shebang, frontmatter & weak keywords in source code pages and code blocks

Before | After
---|---
<img width="517" height="532" alt="Screenshot 2025-10-28 at 23-21-02 pre rs - source" src="https://github.com/user-attachments/assets/5026761f-c604-4bcc-a699-9e75eb73dff6" /> | <img width="499" height="531" alt="Screenshot 2025-10-28 at 23-21-51 pre rs - source" src="https://github.com/user-attachments/assets/cc8c65e7-e3ad-4e20-a2c3-2623cf799093" />
Subtree sync for rustc_codegen_cranelift

The highlights this time are 4 Cranelift updates, some refactorings and a couple of bugfixes.
mgca: Add ConstArg representation for const items

tracking issue: rust-lang/rust#132980
fixes rust-lang/rust#131046
fixes rust-lang/rust#134641

As part of implementing `min_generic_const_args`, we need to distinguish const items that can be used in the type system, such as in associated const equality projections, from const items containing arbitrary const code, which must be kept out of the type system. Specifically, all "type consts" must be either concrete (no generics) or generic with a trivial expression like `N` or a path to another type const item.

To syntactically distinguish these cases, we require, for now at least, that users annotate all type consts with the `#[type_const]` attribute. Then, we validate that the const's right-hand side is indeed eligible to be a type const and represent it differently in the HIR.

We accomplish this representation using a new `ConstItemRhs` enum in the HIR, and a similar but simpler enum in the AST. When `#[type_const]` is **not** applied to a const (e.g. on stable), we represent const item right-hand sides (rhs's) as HIR bodies, like before. However, when the attribute is applied, we instead lower to a `hir::ConstArg`. This syntactically distinguishes between trivial const args (paths) and arbitrary expressions, which are represented using `AnonConst`s. Then in `generics_of`, we can take advantage of the existing machinery to bar the `AnonConst` rhs's from using parent generics.
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#145656 (Stabilize s390x `vector` target feature and `is_s390x_feature_detected!` macro)
 - rust-lang/rust#147024 (std_detect: Support run-time detection on OpenBSD using elf_aux_info)
 - rust-lang/rust#147534 (Implement SIMD funnel shifts in const-eval/Miri)
 - rust-lang/rust#147540 (Stabilise `as_array` in `[_]` and `*const [_]`; stabilise `as_mut_array` in `[_]` and `*mut [_]`.)
 - rust-lang/rust#147686 (update isolate_highest_one for NonZero<T>)
 - rust-lang/rust#148230 (rustdoc: Properly highlight shebang, frontmatter & weak keywords in source code pages and code blocks)
 - rust-lang/rust#148555 (Fix rust-by-example spanish translation)
 - rust-lang/rust#148556 (Fix suggestion for returning async closures)
 - rust-lang/rust#148585 ([rustdoc] Replace `print` methods with functions to improve code readability)
 - rust-lang/rust#148600 (re-use `self.get_all_attrs` result for pass indirectly attribute)

r? `@ghost`
`@rustbot` modify labels: rollup
Encode cfg trace, not its early counterpart to fix cross-crate `doc(auto_cfg)`

Fixes rust-lang/rust#141301.

<details><summary>Rambling about <code>target_feature</code> which I didn't touch here</summary>

Regarding rust-lang/rust#141301 (comment) (`#[target_feature(enable = …)]` on inlined cross-crate re-exports), it has the same underlying cause (namely, we neither encode `target_feature` nor `AttributeKind::TargetFeature` in the crate metadata). However, I didn't make that change because I first want to experiment with querying `TyCtxt::codegen_fn_attrs` in rustdoc instead which already works cross-crate (and also use to it for reconstructing `no_mangle`, `export_name`, `link_section` to avoid encoding these attributes unnecessarily (basically reverting rust-lang/rust#144050) as suggested in rust-lang/rust#144004 (comment)).

</details>

r? GuillaumeGomez
…ieyouxu

Implement the MCP 932: Promote riscv64a23-unknown-linux-gnu to Tier 2

Implement the [MCP 932](rust-lang/compiler-team#932): Promote riscv64a23-unknown-linux-gnu to Tier 2 without host tools.

Closes rust-lang/rust#148353.

Changes:
- Update target tier from 3 to 2 in target specification
- Update platform documentation
- Add CI/CD support for automatic building and distribution via rustup

r? jieyouxu
cc `@davidtwco` `@Noratrieb`
The rustc-josh-sync Cronjob Bot added 2 commits November 10, 2025 04:13
This updates the rust-version file to 8401398e1f14a24670ee1a3203713dc2f0f8b3a8.
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 8401398e1f14a24670ee1a3203713dc2f0f8b3a8
Filtered ref: 52a911b
Upstream diff: rust-lang/rust@c5dabe8...8401398

This merge was created using https://github.com/rust-lang/josh-sync.
@rustbot
Copy link
Collaborator

rustbot commented Nov 10, 2025

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 Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants