Files
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.8 KiB
Rust
Raw Normal View History

//@ add-core-stubs
2024-07-17 16:47:03 +02:00
//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
//@ needs-llvm-components: arm
2025-06-06 23:07:41 -07:00
#![feature(abi_cmse_nonsecure_call, no_core, lang_items)]
2024-07-17 16:47:03 +02:00
#![no_core]
extern crate minicore;
use minicore::*;
2024-07-17 16:47:03 +02:00
#[repr(C)]
struct Wrapper<T>(T);
struct Test<T: Copy> {
2025-06-06 23:07:41 -07:00
f1: extern "cmse-nonsecure-call" fn<U: Copy>(U, u32, u32, u32) -> u64,
2024-09-06 18:43:42 +02:00
//~^ ERROR cannot find type `U` in this scope
//~| ERROR function pointer types may not have generic parameters
f2: extern "cmse-nonsecure-call" fn(impl Copy, u32, u32, u32) -> impl Copy,
2024-07-17 16:47:03 +02:00
//~^ ERROR `impl Trait` is not allowed in `fn` pointer parameters
//~| ERROR `impl Trait` is not allowed in `fn` pointer return types
2025-06-06 23:07:41 -07:00
f3: extern "cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64, //~ ERROR [E0798]
f4: extern "cmse-nonsecure-call" fn(Wrapper<T>, u32, u32, u32) -> u64, //~ ERROR [E0798]
2024-07-17 16:47:03 +02:00
}
2024-09-06 18:43:42 +02:00
2025-06-06 23:07:41 -07:00
type WithReference = extern "cmse-nonsecure-call" fn(&usize);
2024-09-06 18:43:42 +02:00
trait Trait {}
2025-06-06 23:07:41 -07:00
type WithTraitObject = extern "cmse-nonsecure-call" fn(&dyn Trait) -> &dyn Trait;
//~^ ERROR return value of `"cmse-nonsecure-call"` function too large to pass via registers [E0798]
2024-09-06 18:43:42 +02:00
type WithStaticTraitObject =
2025-06-06 23:07:41 -07:00
extern "cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn Trait;
//~^ ERROR return value of `"cmse-nonsecure-call"` function too large to pass via registers [E0798]
2024-09-06 18:43:42 +02:00
#[repr(transparent)]
struct WrapperTransparent<'a>(&'a dyn Trait);
type WithTransparentTraitObject =
2025-06-06 23:07:41 -07:00
extern "cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTransparent;
//~^ ERROR return value of `"cmse-nonsecure-call"` function too large to pass via registers [E0798]
2024-09-06 18:43:42 +02:00
2025-06-06 23:07:41 -07:00
type WithVarArgs = extern "cmse-nonsecure-call" fn(u32, ...);
//~^ ERROR C-variadic functions with the "cmse-nonsecure-call" calling convention are not supported