Files
rust/tests/ui/offload/duplicate_kernel.rs
Marcelo Dominguez b1b0f5e7b4 fix
2026-08-12 20:58:01 +03:00

23 lines
737 B
Rust

//@ compile-flags: -Zunstable-options -Zoffload=Device -Clto=fat -Csymbol-mangling-version=v0 --crate-name collision_kernels_a
//@ build-fail
//@ needs-offload
// An offload kernel whose mangled symbol collides with another item in the
// same crate must be rejected, just like any other symbol collision.
#![feature(core_intrinsics, rustc_attrs)]
#![allow(internal_features)]
#[allow(non_snake_case)]
#[no_mangle]
pub fn _RNvC19collision_kernels_a6kernel(_x: f32) {}
#[rustc_offload_kernel]
fn kernel(_x: f32) {}
//~^ ERROR symbol `_RNvC19collision_kernels_a6kernel` is already defined
fn main() {
_RNvC19collision_kernels_a6kernel(0.0);
core::intrinsics::offload::<_, _, ()>(kernel, [1, 1, 1], [1, 1, 1], 0, (0.0f32,));
}