rust/tests/ui/abi/cannot-be-coroutine.amdgpu.stderr
Flakebi 33add367e2
Add checks for gpu-kernel calling conv
The `gpu-kernel` calling convention has several restrictions that were
not enforced by the compiler until now.
Add the following restrictions:

1. Cannot be async
2. Cannot be called
3. Cannot return values, return type must be `()` or `!`
4. Arguments should be primitives, i.e. passed by value. More complicated
   types can work when you know what you are doing, but it is rather
   unintuitive, one needs to know ABI/compiler internals.
5. Export name should be unmangled, either through `no_mangle` or
   `export_name`. Kernels are searched by name on the CPU side, having
   a mangled name makes it hard to find and probably almost always
   unintentional.
2026-01-01 18:34:24 +01:00

23 lines
575 B
Text

error: functions with the "gpu-kernel" ABI cannot be `async`
--> $DIR/cannot-be-coroutine.rs:62:1
|
LL | async extern "gpu-kernel" fn async_kernel() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the `async` keyword from this definition
|
LL - async extern "gpu-kernel" fn async_kernel() {
LL + extern "gpu-kernel" fn async_kernel() {
|
error: requires `ResumeTy` lang_item
--> $DIR/cannot-be-coroutine.rs:38:19
|
LL | async fn vanilla(){
| ___________________^
LL | |
LL | | }
| |_^
error: aborting due to 2 previous errors