Skip to content

Rollup of 9 pull requests - #163153

Closed
JonathanBrouwer wants to merge 24 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-yGARYGg
Closed

JonathanBrouwer wants to merge 24 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-yGARYGg

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

Warning

This rollup conflicts with pending auto build #162499 and may need to be recreated if the pending build succeeds.

r? @ghost

Create a similar rollup

Jamesbarford and others added 24 commits September 17, 2026 09:36
`is_const_pat_that_looks_like_binding` matched the pattern snippet against a
plain identifier so the `#` in `let r#x = 0` rejected it and the binding lost
both the label pointing at `const x` and the `introduce a variable instead`
suggestion. strip a leading `r#` before the check and render the const name
with `to_ident_string` in the label so a keyword name prints as `r#fn`.

fixes rust-lang#162949
…typeck is tainted

We started to check typeck result's tainted_by_errors in check_pat for LateLint,
But ideally the check should be in a better place which all lints profit from it.
`DiagInner` impls `PartialEq` and `Hash`, as you'd expect for storing it
in a hash table. But there's a couple of strange things.

- We only store the hash value of the `DiagInner` to do deduplication,
  not the `DiagInner` itself, which means the `PartialEq` impl is
  unused.

- The `Hash` impl only considers some of the fields. Some of the ignored
  fields are clearly deliberate (there are comments) but for some it is
  unclear if it is deliberate.

This commit:

- Removes the unused `PartialEq` impl.

- Inlines and removes `keys` now that it's not needed for `PartialEq`.

- Uses struct deconstruction to ensure no fields can be accidentally
  ignored. I have preserved existing behaviour by assuming that all the
  ignored fields are supposed to be ignored.

- Renames `hash` as an inherent method `dedup_hash` to indicate that
  it's not a typical hash function, and simplifies it to just return
  `Hash128` instead of being generic.

- Replaces the unnecessary `collect` on `args` with `as_slice`.

- Improves the comment on `emitted_diagnostics`.
Both will be used by the amdgpu target to implement the `gpu-kernel`
ABI.

`address_space` specifies the address space of an indirect argument.

`AmdgpuKernelArg` translates to LLVM’s byref, which is similar to
on_stack/byval, however, there is no extra copy made, the pointer may
not point to the stack but can point to some other address space, and
the passed argument should not be modified.

byval and byref are mutually exclusive, so change on_stack to an enum
with the new states, Pointer (none), OnStack and AmdgpuKernelArg.
Add support to pass structs, arrays and vectors to amdgpu kernels.
Scalars and vectors are taken by value, aggregates are passed by byref
pointers. Structs containing a single scalar/vector are handled like
a scalar.

Judging from clang tests, nvptx seems to do somewhat the same, just
using byval instead of byref: https://github.com/llvm/llvm-project/blob/3a8affeef4da19d39191aac316e189eca3214a8c/clang/test/CodeGenCUDA/kernel-args.cu

I tested a couple of the lit test signatures on real hardware and it
seems to work fine. Given the relatively simple implementation, I hope
this amount of testing is enough (the C calling convention seems like
a worse fit for Rust’s current ABI code, it’s still giving me headaches).
… r=lcnr

Move `Const` from `rustc_middle` to `rustc_type_ir`

Split by commit;
- Firstly move the type and methods
- From `I::Const` -> `Const<I>`
- Import `ConstExt` in all places that require the extension trait methods in compiler
- Import `ConstExt` in all places that require the extension trait methods in clippy

r? @lcnr
… r=oli-obk

Check tainted_by_error in LateLint

## Context
This PR continues from rust-lang#138679 (comment).
In the last PR, I introduced typeck result's tainted_by_error in check_pat. But as we've discussed, I should put the check to a better place which all lints get benefit from the check.

## Change
Since visit_nested_body in late.rs is the starting point of late lint for a nested body, I moved the error check to the function.
I also rename one ui test case which I introduced in the last PR. I think the new name describes what the test wants to check more.

This PR fixes rust-lang#138361 .

Note that we need to use actually_rustdoc to call typeck_body() in visit_nested_body. Otherwise rustdoc returns an error. However, as its comment describes we shouldn't use actually_rustdoc if there is an alternative solution. So far I only come up with using actually_rustdoc (this change), or checking tainted_by_error in each check_xxx functions (e.g., check on check_pat in rust-lang#138679, and on check_expr for rust-lang#138361).
Properly implement the gpu-kernel ABI for amdgpu

Add support to pass structs, arrays and vectors to amdgpu kernels.
Scalars and vectors are taken by value, aggregates are passed by byref
pointers. Structs containing a single scalar/vector are handled like
a scalar.

Judging from clang tests, nvptx seems to do somewhat the same, just
using byval instead of byref: https://github.com/llvm/llvm-project/blob/e4e18dba3d77f4a3eea58bcc9ccae5a5498ede7c/clang/test/CodeGenCUDA/kernel-args.cu

I tested a couple of the lit test signatures on real hardware and it
seems to work fine. Given the relatively simple implementation, I hope
this amount of testing is enough (the C calling convention seems like
a worse fit for Rust’s current ABI code, it’s still giving me headaches).

This adds two members to `PassMode::Indirect`.

`address_space` specifies the address space of an on_stack/byval or
by_ref pointer argument.

`by_ref` translates to LLVM’s byref, which is similar to on_stack/byval,
however, there is no extra copy made, the pointer may not point to the
stack but can point to some other address space, and the passed argument
should not be modified.

Both are used by the amdgpu target to implement the `gpu-kernel`
ABI.

Tracking issue for the `gpu-kernel` ABI: rust-lang#135467
Tracking issue for the amdgpu target: rust-lang#135024
Avoid generating overlapping assignments in DSE

This is a fix for rust-lang#162997.

Considering we also had rust-lang#155680, I really wonder if this pass should be using LivenessTransferFunction at all.
…=oli-obk

remove unnecessary restriction with next-solver

We previously FCP'd to forbid uses of opaque types which only differ in their lifetime arguments during MIR borrowck in rust-lang#116935 (comment). This actually did not end up being necessary after all. Will explain this a bit more in the stabilization documentation for the new solver

r? types
…-idents, r=oli-obk

emit the constant pattern note for raw identifier bindings

`is_const_pat_that_looks_like_binding` matched the pattern snippet against a plain identifier so the `#` in `let r#x = 0` rejected it and the binding lost both the label pointing at `const x` and the `introduce a variable instead` suggestion. strip a leading `r#` before the check and render the const name with `to_ident_string` in the label so a keyword name prints as `r#fn`.

fixes rust-lang#162949

r? @oli-obk
add `feature(field_projections)` fixme

see the added fixme :>

r? types
…r=oli-obk

Clean up diagnostic hashing

`DiagInner` impls `PartialEq` and `Hash`, as you'd expect for storing it in a hash table. But there's a couple of strange things.

- We only store the hash value of the `DiagInner` to do deduplication, not the `DiagInner` itself, which means the `PartialEq` impl is unused.

- The `Hash` impl only considers some of the fields. Some of the ignored fields are clearly deliberate (there are comments) but for some it is unclear if it is deliberate.

This commit:

- Removes the unused `PartialEq` impl.

- Inlines and removes `keys` now that it's not needed for `PartialEq`.

- Uses struct deconstruction to ensure no fields can be accidentally ignored. I have preserved existing behaviour by assuming that all the ignored fields are supposed to be ignored.

- Renames `hash` as an inherent method `dedup_hash` to indicate that it's not a typical hash function, and simplifies it to just return `Hash128` instead of being generic.

- Replaces the unnecessary `collect` on `args` with `as_slice`.

- Improves the comment on `emitted_diagnostics`.

r? @oli-obk
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Sep 22, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-explicit_tail_calls `#![feature(explicit_tail_calls)]` PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. labels Sep 22, 2026
@rustbot rustbot added 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 22, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 22, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 22, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r+ p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,test-x86_64-gnu-aux,test-x86_64-gnu-llvm-21-3,test-x86_64-msvc-1,test-aarch64-apple-1,test-aarch64-apple-2,test-x86_64-mingw-1,test-i686-msvc,test-armhf-gnu

@rust-bors

rust-bors Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 16a5b1d has been approved by JonathanBrouwer

It is now in the queue for this repository.

@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 Sep 22, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 22, 2026
Rollup of 9 pull requests


try-job: dist-various-1
try-job: test-various
try-job: test-x86_64-gnu-aux
try-job: test-x86_64-gnu-llvm-21-3
try-job: test-x86_64-msvc-1
try-job: test-aarch64-apple-1
try-job: test-aarch64-apple-2
try-job: test-x86_64-mingw-1
try-job: test-i686-msvc
try-job: test-armhf-gnu
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 22, 2026
@rust-bors

rust-bors Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

This pull request was unapproved.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 22, 2026
@rust-bors

rust-bors Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c1cb66f (c1cb66f217a18d9addb58f5a0fd759540cb0a9eb)
Base parent: e5b9509 (e5b95097d9a14bdec7cd9101dde67ee3aad2578a)

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. F-explicit_tail_calls `#![feature(explicit_tail_calls)]` PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup T-clippy Relevant to the Clippy team. 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants