rust/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.7 KiB
Rust
Raw Normal View History

2024-07-17 09:47:03 -05:00
//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
//@ needs-llvm-components: arm
#![feature(abi_c_cmse_nonsecure_call, no_core, lang_items)]
#![no_core]
#[lang = "sized"]
pub trait Sized {}
#[lang = "copy"]
pub trait Copy {}
impl Copy for u32 {}
#[repr(C)]
struct Wrapper<T>(T);
struct Test<T: Copy> {
2024-09-06 11:43:42 -05:00
f1: extern "C-cmse-nonsecure-call" fn<U: Copy>(U, u32, u32, u32) -> u64,
//~^ ERROR cannot find type `U` in this scope
//~| ERROR function pointer types may not have generic parameters
2024-07-17 09:47:03 -05:00
f2: extern "C-cmse-nonsecure-call" fn(impl Copy, u32, u32, u32) -> u64,
//~^ ERROR `impl Trait` is not allowed in `fn` pointer parameters
f3: extern "C-cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64, //~ ERROR [E0798]
f4: extern "C-cmse-nonsecure-call" fn(Wrapper<T>, u32, u32, u32) -> u64, //~ ERROR [E0798]
}
2024-09-06 11:43:42 -05:00
type WithReference = extern "C-cmse-nonsecure-call" fn(&usize);
trait Trait {}
type WithTraitObject = extern "C-cmse-nonsecure-call" fn(&dyn Trait) -> &dyn Trait;
//~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798]
type WithStaticTraitObject =
extern "C-cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn Trait;
//~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798]
#[repr(transparent)]
struct WrapperTransparent<'a>(&'a dyn Trait);
type WithTransparentTraitObject =
extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTransparent;
//~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798]
type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...);
//~^ ERROR C-variadic function must have a compatible calling convention, like `C` or `cdecl` [E0045]