Skip to content

Commit 2912efa

Browse files
committed
c-variadic: update cmse-nonsecure example
1 parent 2b9fce8 commit 2912efa

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,20 @@ extern "cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trait {
5353
x
5454
}
5555

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

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

66-
extern "cmse-nonsecure-entry" fn wrapped_trait_object(
67-
x: WrapperTransparent,
68-
) -> WrapperTransparent {
64+
extern "cmse-nonsecure-entry" fn wrapped_trait_object(x: WrapperTransparent) -> WrapperTransparent {
6965
//~^ ERROR return value of `"cmse-nonsecure-entry"` function too large to pass via registers [E0798]
7066
x
7167
}
7268

73-
extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
69+
unsafe extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
7470
//~^ ERROR defining functions with C-variadic arguments is only allowed for free functions with the "C" or "C-unwind" calling convention
7571
//~| ERROR requires `va_list` lang_item
7672
}

tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: defining functions with C-variadic arguments is only allowed for free functions with the "C" or "C-unwind" calling convention
2-
--> $DIR/generics.rs:73:53
2+
--> $DIR/generics.rs:69:60
33
|
4-
LL | extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
5-
| ^^^^^^
4+
LL | unsafe extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
5+
| ^^^^^^
66

77
error[E0798]: functions with the `"cmse-nonsecure-entry"` ABI cannot contain generics in their type
88
--> $DIR/generics.rs:30:1
@@ -50,28 +50,28 @@ LL | extern "cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trait
5050
= note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
5151

5252
error[E0798]: return value of `"cmse-nonsecure-entry"` function too large to pass via registers
53-
--> $DIR/generics.rs:58:6
53+
--> $DIR/generics.rs:56:80
5454
|
55-
LL | ) -> &'static dyn Trait {
56-
| ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers
55+
LL | extern "cmse-nonsecure-entry" fn static_trait_object(x: &'static dyn Trait) -> &'static dyn Trait {
56+
| ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers
5757
|
5858
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass their result via the available return registers
5959
= note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
6060

6161
error[E0798]: return value of `"cmse-nonsecure-entry"` function too large to pass via registers
62-
--> $DIR/generics.rs:68:6
62+
--> $DIR/generics.rs:64:81
6363
|
64-
LL | ) -> WrapperTransparent {
65-
| ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers
64+
LL | extern "cmse-nonsecure-entry" fn wrapped_trait_object(x: WrapperTransparent) -> WrapperTransparent {
65+
| ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers
6666
|
6767
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass their result via the available return registers
6868
= note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
6969

7070
error: requires `va_list` lang_item
71-
--> $DIR/generics.rs:73:53
71+
--> $DIR/generics.rs:69:60
7272
|
73-
LL | extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
74-
| ^^^^^^
73+
LL | unsafe extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
74+
| ^^^^^^
7575

7676
error: aborting due to 9 previous errors
7777

0 commit comments

Comments
 (0)