Skip to content

Rollup of 8 pull requests - #162975

Closed
JonathanBrouwer wants to merge 36 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-S1YbZhb
Closed

JonathanBrouwer wants to merge 36 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-S1YbZhb

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

maxdexh and others added 30 commits September 13, 2026 21:24
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).
`into_owner_info` arena-allocates the created `OwnerInfo`.
`ItemLowerer::with_lctx` calls `into_owner_info` and then
re-arena-allocates the returned `OwnerInfo` (the reference, not the
entire struct). This commit removes the latter.
As `LoweringContext::current_item_span`, because it *is* a span.
It's trivial and has a single call site.
It's just a thin wrapper around `tcx` and `resolver`. The `lower_*`
methods all have a single call site and can be inlined, and `with_lctx`
can just be a local fn within `lower_to_hir`.

This requires increasing the visibility of some
`LoweringContext::lower_*` methods that are now called outside of
`item.rs`.
…value

These functions didn't actually modifiy the operand or return a new or
different expression. So essentially the "`fn(Box<Expr>) -> Box<Expr>`
part" was an identity function. Just change it to "fn(&Expr)".
`recover_from_inc_dec` *always* returns a (fatal) `Err(_)` *except* if
the increment/decrement operator is a subexpression *and* the source of
the operand is not available in which case it emits the diagnostic and
returns `Ok(_)` (rendering it non-fatal).

This makes no sense whatsoever. For illustration purposes, listed below
are steps that would make us reach this case:

1. `rustc a.rs --crate-type=lib` where `a.rs` contains:
   `#[macro_export] macro_rules! m { () => { i++ } }`.
2. Move or remove `a.rs`
3. `rustc b.rs --edition 2018 --extern a -L.` where
   `b.rs` contains:
   `fn main() { (a::m!()); }`.

Just make the error unconditionally fatal and add a FIXME to make it non
fatal in the future which would allow us to report name resolution errors
and what not. However, since that would be slightly more involved and
represent a behavior change (in the error path), this is out of scope for
a mere cleanup commit like this one.
There's literally no upside to use it and only downsides:
It's not more concise, only adds code and obfuscates.
Its `MultiSugg::emit{,_verbose}` didn't even *emit* the diagnostic,
they merely *decorated* it!
1. Remove unnecessary rebindings (`op_span` and `op = op.node`)
2. Remove binding `cur_op_span` as it's equal to `op.span`
3. Merge two `match`es on `op.node` into one to make the control flow
   more obvious and to render everything more legible. Moreover,
   it allows us to drop an ungly `unreachable!()`
Previously we would check if the current operator was `Binary(Lt)` and
the current token was `>` to determine if we're looking at `<>`.

However, since `AssocOp::from_token` also treats `<-` as `Binary(Lt)`
for better error recovery, the condition would also hold for `<->`
(`<-`, `>`) which is not what we want. E.g., given `1 <-> 2` we would
previously emit diagnostic "invalid comparison operator `<>`".

---

Also update `recover_from_spaceship_cmp_op` to do something similar --
not to fix anything but simply to eliminate param `op: Spanned<AssocOp>`.
…ertdev

`core::num::f16b` Rust's 16bit Brain Float

Implements the [RFC: f16b type](rust-lang/rfcs#3983). Best reviewed commit by commit, happy to split into separate PRs if that is deemed easier to review. However the line count and surface area is, in my opinion, reasonably small.

Adds;
- ABI plumbing for the `f16b` along with `bfloat` lang item to work with LLVM, GCC is explicitly `unimplemented!(...)`
- `f16b` feature gate, page for `f16b` on libruscdoc and a `struct bf16` in `core::num`
- Tests
- Treat `f16b` as a scalar primitive for scalable vectors

Issues;
- [Tracking Issue](rust-lang#160630)
- [RFC](rust-lang/rfcs#3983)
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
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Sep 18, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` A-tidy Area: The tidy tool F-explicit_tail_calls `#![feature(explicit_tail_calls)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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. labels Sep 18, 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 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d2d7897 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 18, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 18, 2026
Rollup of 8 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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 18, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #160859 (`core::num::f16b` Rust's 16bit Brain Float)
 - #162177 (Properly implement the gpu-kernel ABI for amdgpu)
 - #162591 (Move parse error recovery for expression operators "out of line" & refactor in the area)
 - #162733 (Add useful APIs to `Unique(Arc|Rc)`)
 - #162950 (More AST lowering cleanups)
 - #162964 (Update `browser-ui-test` version to `0.25.2`)
 - #162797 (yeet AliasConstKind::opt_def_id)
 - #162836 (Ping T-libs-ping instead of T-libs-fcp for backports)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-x86_64-gnu-nopt failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/float/f16b.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/float/f16b.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/float/f16b/a" "-Znext-solver=coherence" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--check-cfg=cfg(target_has_reliable_f16b)"
stdout: none
--- stderr -------------------------------
error: linking with `cc` failed: exit status: 1
   |
   = note:  "cc" "-m64" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/float/f16b/rustccAlleh/symbols.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bdynamic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1ae09a3721ccfcdf.so" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-*.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/float/f16b/rustccAlleh/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/float/f16b/a" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-debug" "-nodefaultlibs" "-Wl,-rpath,$ORIGIN/../../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib,--enable-new-dtags,-z,origin"
   = note: some arguments are omitted. use `--verbose` to show all linker arguments
   = note: rust-lld: error: undefined symbol: __truncsfbf2
           >>> referenced by f16b.adc03c64e5889bf6-cgu.0
           >>>               /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/float/f16b/a.f16b.adc03c64e5889bf6-cgu.0.rcgu.o:(f16b::main)
           >>> referenced by f16b.adc03c64e5889bf6-cgu.0
           >>>               /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/float/f16b/a.f16b.adc03c64e5889bf6-cgu.0.rcgu.o:(<core::num::bfloat::f16b>::to_bits)
           >>> referenced by f16b.adc03c64e5889bf6-cgu.0
           >>>               /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/float/f16b/a.f16b.adc03c64e5889bf6-cgu.0.rcgu.o:(<f32 as core::convert::From<core::num::bfloat::f16b>>::from)
           >>> did you mean: __truncsfhf2
           >>> defined in: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libgcc_s.so.1
           collect2: error: ld returned 1 exit status
           

error: aborting due to 1 previous error
------------------------------------------

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

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

💔 Test for d0bc013 failed: CI. Failed job:

@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c31277b (c31277ba551294018fe7f315217eb09f8bd3bf3d)
Base parent: 420ed2a (420ed2a0c3d7225b1744266fd884d431b4d8cfe0)

@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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2026
@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

PR #160859, which is a member of this rollup, 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 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` A-tidy Area: The tidy tool F-explicit_tail_calls `#![feature(explicit_tail_calls)]` rollup A PR which is a rollup T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.