about summary refs log tree commit diff
path: root/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs
blob: aee01e25ddc4fd6582a783c472a7f69214e4301a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//@ add-core-stubs
//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
//@ needs-llvm-components: arm
#![feature(cmse_nonsecure_entry, no_core, lang_items)]
#![no_core]

extern crate minicore;
use minicore::*;

#[repr(C)]
struct Wrapper<T>(T);

impl<T: Copy> Wrapper<T> {
    extern "cmse-nonsecure-entry" fn ambient_generic(_: T, _: u32, _: u32, _: u32) -> u64 {
        //~^ ERROR [E0798]
        0
    }

    extern "cmse-nonsecure-entry" fn ambient_generic_nested(
        //~^ ERROR [E0798]
        _: Wrapper<T>,
        _: u32,
        _: u32,
        _: u32,
    ) -> u64 {
        0
    }
}

extern "cmse-nonsecure-entry" fn introduced_generic<U: Copy>(
    //~^ ERROR [E0798]
    _: U,
    _: u32,
    _: u32,
    _: u32,
) -> u64 {
    0
}

extern "cmse-nonsecure-entry" fn impl_trait(_: impl Copy, _: u32, _: u32, _: u32) -> u64 {
    //~^ ERROR [E0798]
    0
}

extern "cmse-nonsecure-entry" fn reference(x: &usize) -> usize {
    *x
}

trait Trait {}

extern "cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trait {
    //~^ ERROR return value of `"cmse-nonsecure-entry"` function too large to pass via registers [E0798]
    x
}

extern "cmse-nonsecure-entry" fn static_trait_object(x: &'static dyn Trait) -> &'static dyn Trait {
    //~^ ERROR return value of `"cmse-nonsecure-entry"` function too large to pass via registers [E0798]
    x
}

#[repr(transparent)]
struct WrapperTransparent<'a>(&'a dyn Trait);

extern "cmse-nonsecure-entry" fn wrapped_trait_object(x: WrapperTransparent) -> WrapperTransparent {
    //~^ ERROR return value of `"cmse-nonsecure-entry"` function too large to pass via registers [E0798]
    x
}