Skip to content

Rollup of 11 pull requests#154701

Closed
jhpratt wants to merge 49 commits intorust-lang:mainfrom
jhpratt:rollup-u0ZMiMs
Closed

Rollup of 11 pull requests#154701
jhpratt wants to merge 49 commits intorust-lang:mainfrom
jhpratt:rollup-u0ZMiMs

Conversation

@jhpratt
Copy link
Copy Markdown
Member

@jhpratt jhpratt commented Apr 2, 2026

Successful merges:

r? @ghost

Create a similar rollup

Zoxc and others added 30 commits March 24, 2026 18:25
Instead of just using regular struct lowering for these types, which
results in an incorrect ABI (e.g. returning indirectly), use
`BackendRepr::ScalableVector` which will lower to the correct type and
be passed in registers.

This also enables some simplifications for generating alloca of scalable
vectors and greater re-use of `scalable_vector_parts`.

A LLVM codegen test demonstrating the changed IR this generates is
included in the next commit alongside some intrinsics that make these
tuples usable.
Clang changed to representing tuples of scalable vectors as
structs rather than as wide vectors (that is, scalable vector types
where the `N` part of the `<vscale x N x ty>` type was multiplied by
the number of vectors). rustc mirrored this in the initial implementation
of scalable vectors.

Earlier versions of our patches used the wide vector representation and
our intrinsic patches used the legacy
`llvm.aarch64.sve.tuple.{create,get,set}{2,3,4}` intrinsics for creating
these tuples/getting/setting the vectors, which were only supported
due to LLVM's `AutoUpgrade` pass converting these intrinsics into
`llvm.vector.insert`. `AutoUpgrade` only supports these legacy intrinsics
with the wide vector representation.

With the current struct representation, Clang has special handling in
codegen for generating `insertvalue`/`extractvalue` instructions for
these operations, which must be replicated by rustc's codegen for our
intrinsics to use. This patch implements new intrinsics in
`core::intrinsics::scalable` (mirroring the structure of
`core::intrinsics::simd`) which rustc lowers to the appropriate
`insertvalue`/`extractvalue` instructions.
Generate debuginfo for scalable vectors, following the structure that
Clang generates for scalable vectors.
Abstract over the existing `simd_cast` intrinsic to implement a new
`sve_cast` intrinsic - this is better than allowing scalable vectors to
be used with all of the generic `simd_*` intrinsics.
PR rust-lang#154634 recently renamed many type parameters that impl
`HashStableContext` as `Hcx`. It missed a few that are named `HirCtx`.
This commit renames them.
They're in multiple sections with no rhyme or reason.
`derive(HashStable_Generic)` generates impls like this:
```
impl<__CTX> HashStable<__CTX> for ExpnKind
where
    __CTX: crate::HashStableContext
{
    fn hash_stable(&self, hcx : &mut __CTX, __hasher: &mut StableHasher) {
        ...
    }
}
```
This is used for crates that are upstream of `rustc_middle`.

The `crate::HashStableContext` bound means every crate that uses
`derive(HashStable_Generic)` must provide (or import) a trait
`HashStableContext` which `rustc_middle` then impls. In `rustc_span`
this trait is sensible, with three methods. In other crates, this trait
is empty, and there is the following trait hierarchy:
```
rustc_session::HashStableContext
  |              |
  |   rustc_hir::HashStableContext
  |         /                   \
rustc_ast::HashStableContext   rustc_abi::HashStableContext
  |
rustc_span::HashStableContext
```
All very strange and unnecessary. This commit changes
`derive(HashStable_Generic)` to use `rustc_span::HashStableContext`
instead of `crate::HashStableContext`. This eliminates the need for all
the empty `HashStableContext` traits and impls. Much better.
This annotates the `Arc` type with the diagnostic attribute
`#[diagnostic::on_move]`. Now when a moved `Arc` is borrowed,
a suggestion to clone it is made, with a label explaining why.
… r=Urgau

[rustdoc] Replace `DocContext` with `TyCtxt` wherever possible

In a lot of places, we pass down `DocContext` but actually only use its `tcx` field (`TyCtxt`). To make it more obvious what's actually being done, I replaced `DocContext` with `TyCtxt` (which implements `Copy`) in the function arguments. It created quite the cascade effect so I ended up with a lot more changes I expected.

Because it's a lot of changes, I made small commits which are easy to go through, so I strongly recommend reviewing this PR one commit at a time.

r? @Urgau
@rust-bors rust-bors bot added the rollup A PR which is a rollup label Apr 2, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Apr 2, 2026
@jhpratt
Copy link
Copy Markdown
Member Author

jhpratt commented Apr 2, 2026

@bors try jobs=test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1

@bors r+ rollup=never p=5

@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 2, 2026

📌 Commit 534d7ff has been approved by jhpratt

It is now in the queue for this repository.

rust-bors bot pushed a commit that referenced this pull request Apr 2, 2026
Rollup of 11 pull requests


try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple
try-job: x86_64-mingw-1
@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 2, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 2, 2026

☀️ Try build successful (CI)
Build commit: dd476ee (dd476ee6d3a89f5071cc75f9375e5ba7f154e851, parent: 7e46c5f6fb87f8cf4353e058479cef15d1d952b4)

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Apr 2, 2026
Rollup of 11 pull requests

Successful merges:

 - #153105 (Compute the result of a projection type with region errors)
 - #153286 (various fixes for scalable vectors)
 - #153960 (Make `layout_of` cycles fatal errors)
 - #154527 (Emit pre-expansion feature gate warnings for negative impls and specialization)
 - #154666 (Remove `StableHashContext` impls)
 - #154669 (Introduce #[diagnostic::on_move] on `Arc`)
 - #154442 (Export `derive` at the crate root: `core::derive` and `std::derive`)
 - #154644 (rustdoc: seperate methods and associated functions in sidebar)
 - #154660 (Avoid creating async return opaques for foreign async fns)
 - #154671 (Add a test for a past ICE when calling a const fn of an unresolved type with the wrong number of args)
 - #154680 ([rustdoc] Replace `DocContext` with `TyCtxt` wherever possible)
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job dist-various-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling compiler_builtins v0.1.160 (/checkout/library/compiler-builtins/compiler-builtins)
warning: enabling the `neon` target feature on the current target is unsound due to ABI issues
  --> /rustc/21dbcd256a396fe429548a679723cd57ffcee409/library/core/src/intrinsics/simd/scalable.rs:25:18
   |
25 | #[target_feature(enable = "sve")]
   |                  ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #134375 <https://github.com/rust-lang/rust/issues/134375>
   = note: `#[warn(aarch64_softfloat_neon)]` (part of `#[warn(future_incompatible)]`) on by default

warning: enabling the `neon` target feature on the current target is unsound due to ABI issues
  --> /rustc/21dbcd256a396fe429548a679723cd57ffcee409/library/core/src/intrinsics/simd/scalable.rs:38:18
   |
38 | #[target_feature(enable = "sve")]
   |                  ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #134375 <https://github.com/rust-lang/rust/issues/134375>

warning: enabling the `neon` target feature on the current target is unsound due to ABI issues
  --> /rustc/21dbcd256a396fe429548a679723cd57ffcee409/library/core/src/intrinsics/simd/scalable.rs:51:18
   |
51 | #[target_feature(enable = "sve")]
   |                  ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #134375 <https://github.com/rust-lang/rust/issues/134375>

warning: enabling the `neon` target feature on the current target is unsound due to ABI issues
  --> /rustc/21dbcd256a396fe429548a679723cd57ffcee409/library/core/src/intrinsics/simd/scalable.rs:64:18
   |
64 | #[target_feature(enable = "sve")]
   |                  ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #134375 <https://github.com/rust-lang/rust/issues/134375>

warning: enabling the `neon` target feature on the current target is unsound due to ABI issues
  --> /rustc/21dbcd256a396fe429548a679723cd57ffcee409/library/core/src/intrinsics/simd/scalable.rs:81:18
   |
81 | #[target_feature(enable = "sve")]
   |                  ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #134375 <https://github.com/rust-lang/rust/issues/134375>

warning: enabling the `neon` target feature on the current target is unsound due to ABI issues
  --> /rustc/21dbcd256a396fe429548a679723cd57ffcee409/library/core/src/intrinsics/simd/scalable.rs:98:18
   |
98 | #[target_feature(enable = "sve")]
   |                  ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #134375 <https://github.com/rust-lang/rust/issues/134375>

@rust-bors rust-bors bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 2, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 2, 2026

💔 Test for 21dbcd2 failed: CI. Failed job:

@jhpratt jhpratt closed this Apr 2, 2026
@rust-bors rust-bors bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 2, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 2, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 2, 2026

PR #153286, which is a member of this rollup, was unapproved.

@jhpratt jhpratt deleted the rollup-u0ZMiMs branch April 2, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.