about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-15 05:02:38 +0000
committerbors <bors@rust-lang.org>2024-10-15 05:02:38 +0000
commit88f311479dd19288e5ad85e22cd80368489ce1e9 (patch)
treea3111d2bfbd3be9cc54af57ee3c366d7b68316fd /tests
parent785c83015cb39b832cd54263823f78a1bc43c4a0 (diff)
parent83252bd780bbce636e8dce64003985b31515e295 (diff)
downloadrust-88f311479dd19288e5ad85e22cd80368489ce1e9.tar.gz
rust-88f311479dd19288e5ad85e22cd80368489ce1e9.zip
Auto merge of #131724 - matthiaskrgr:rollup-ntgkkk8, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #130608 (Implemented `FromStr` for `CString` and `TryFrom<CString>` for `String`)
 - #130635 (Add `&pin (mut|const) T` type position sugar)
 - #130747 (improve error messages for `C-cmse-nonsecure-entry` functions)
 - #131137 (Add 1.82 release notes)
 - #131328 (Remove unnecessary sorts in `rustc_hir_analysis`)
 - #131496 (Stabilise `const_make_ascii`.)
 - #131706 (Fix two const-hacks)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/async-await/pin-sugar-ambiguity.rs15
-rw-r--r--tests/ui/async-await/pin-sugar-no-const.rs8
-rw-r--r--tests/ui/async-await/pin-sugar-no-const.stderr15
-rw-r--r--tests/ui/async-await/pin-sugar.rs51
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs77
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr78
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs16
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs21
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr4
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs26
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr43
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs84
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr84
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr9
-rw-r--r--tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs89
-rw-r--r--tests/ui/feature-gates/feature-gate-pin_ergonomics.rs11
-rw-r--r--tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr45
17 files changed, 625 insertions, 51 deletions
diff --git a/tests/ui/async-await/pin-sugar-ambiguity.rs b/tests/ui/async-await/pin-sugar-ambiguity.rs
new file mode 100644
index 00000000000..d183000931e
--- /dev/null
+++ b/tests/ui/async-await/pin-sugar-ambiguity.rs
@@ -0,0 +1,15 @@
+//@ check-pass
+#![feature(pin_ergonomics)]
+#![allow(dead_code, incomplete_features)]
+
+// Handle the case where there's ambiguity between pin as a contextual keyword and pin as a path.
+
+struct Foo;
+
+mod pin {
+    pub struct Foo;
+}
+
+fn main() {
+    let _x: &pin ::Foo = &pin::Foo;
+}
diff --git a/tests/ui/async-await/pin-sugar-no-const.rs b/tests/ui/async-await/pin-sugar-no-const.rs
new file mode 100644
index 00000000000..dd6456b6034
--- /dev/null
+++ b/tests/ui/async-await/pin-sugar-no-const.rs
@@ -0,0 +1,8 @@
+#![feature(pin_ergonomics)]
+#![allow(incomplete_features)]
+
+// Makes sure we don't accidentally accept `&pin Foo` without the `const` keyword.
+
+fn main() {
+    let _x: &pin i32 = todo!(); //~ ERROR found `i32`
+}
diff --git a/tests/ui/async-await/pin-sugar-no-const.stderr b/tests/ui/async-await/pin-sugar-no-const.stderr
new file mode 100644
index 00000000000..5f01156c1f0
--- /dev/null
+++ b/tests/ui/async-await/pin-sugar-no-const.stderr
@@ -0,0 +1,15 @@
+error: expected one of `!`, `(`, `::`, `;`, `<`, or `=`, found `i32`
+  --> $DIR/pin-sugar-no-const.rs:7:18
+   |
+LL |     let _x: &pin i32 = todo!();
+   |           -      ^^^ expected one of `!`, `(`, `::`, `;`, `<`, or `=`
+   |           |
+   |           while parsing the type for `_x`
+   |
+help: there is a keyword `in` with a similar name
+   |
+LL |     let _x: &in i32 = todo!();
+   |              ~~
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/async-await/pin-sugar.rs b/tests/ui/async-await/pin-sugar.rs
new file mode 100644
index 00000000000..8dbdec418b1
--- /dev/null
+++ b/tests/ui/async-await/pin-sugar.rs
@@ -0,0 +1,51 @@
+//@ check-pass
+
+#![feature(pin_ergonomics)]
+#![allow(dead_code, incomplete_features)]
+
+// Makes sure we can handle `&pin mut T` and `&pin const T` as sugar for `Pin<&mut T>` and
+// `Pin<&T>`.
+
+use std::pin::Pin;
+
+struct Foo;
+
+impl Foo {
+    fn baz(self: &pin mut Self) {
+    }
+
+    fn baz_const(self: &pin const Self) {
+    }
+
+    fn baz_lt<'a>(self: &'a pin mut Self) {
+    }
+
+    fn baz_const_lt(self: &'_ pin const Self) {
+    }
+}
+
+fn foo(_: &pin mut Foo) {
+}
+
+fn foo_const(x: &pin const Foo) {
+}
+
+fn bar(x: &pin mut Foo) {
+    foo(x);
+    foo(x); // for this to work we need to automatically reborrow,
+            // as if the user had written `foo(x.as_mut())`.
+
+    Foo::baz(x);
+    Foo::baz(x);
+
+    // make sure we can reborrow &mut as &.
+    foo_const(x);
+    Foo::baz_const(x);
+
+    let x: &pin const _ = Pin::new(&Foo);
+
+    foo_const(x); // make sure reborrowing from & to & works.
+    foo_const(x);
+}
+
+fn main() {}
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs
new file mode 100644
index 00000000000..a264bba6f3c
--- /dev/null
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs
@@ -0,0 +1,77 @@
+//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
+//@ needs-llvm-components: arm
+#![feature(cmse_nonsecure_entry, c_variadic, 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);
+
+impl<T: Copy> Wrapper<T> {
+    extern "C-cmse-nonsecure-entry" fn ambient_generic(_: T, _: u32, _: u32, _: u32) -> u64 {
+        //~^ ERROR [E0798]
+        0
+    }
+
+    extern "C-cmse-nonsecure-entry" fn ambient_generic_nested(
+        //~^ ERROR [E0798]
+        _: Wrapper<T>,
+        _: u32,
+        _: u32,
+        _: u32,
+    ) -> u64 {
+        0
+    }
+}
+
+extern "C-cmse-nonsecure-entry" fn introduced_generic<U: Copy>(
+    //~^ ERROR [E0798]
+    _: U,
+    _: u32,
+    _: u32,
+    _: u32,
+) -> u64 {
+    0
+}
+
+extern "C-cmse-nonsecure-entry" fn impl_trait(_: impl Copy, _: u32, _: u32, _: u32) -> u64 {
+    //~^ ERROR [E0798]
+    0
+}
+
+extern "C-cmse-nonsecure-entry" fn reference(x: &usize) -> usize {
+    *x
+}
+
+trait Trait {}
+
+extern "C-cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trait {
+    //~^ ERROR return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers [E0798]
+    x
+}
+
+extern "C-cmse-nonsecure-entry" fn static_trait_object(
+    x: &'static dyn Trait,
+) -> &'static dyn Trait {
+    //~^ ERROR return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers [E0798]
+    x
+}
+
+#[repr(transparent)]
+struct WrapperTransparent<'a>(&'a dyn Trait);
+
+extern "C-cmse-nonsecure-entry" fn wrapped_trait_object(
+    x: WrapperTransparent,
+) -> WrapperTransparent {
+    //~^ ERROR return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers [E0798]
+    x
+}
+
+extern "C-cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
+    //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
+    //~| ERROR requires `va_list` lang_item
+}
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr
new file mode 100644
index 00000000000..9e67f881f75
--- /dev/null
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr
@@ -0,0 +1,78 @@
+error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
+  --> $DIR/generics.rs:74:55
+   |
+LL | extern "C-cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
+   |                                                       ^^^^^^
+
+error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type
+  --> $DIR/generics.rs:31:1
+   |
+LL | / extern "C-cmse-nonsecure-entry" fn introduced_generic<U: Copy>(
+LL | |
+LL | |     _: U,
+LL | |     _: u32,
+LL | |     _: u32,
+LL | |     _: u32,
+LL | | ) -> u64 {
+   | |________^
+
+error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type
+  --> $DIR/generics.rs:41:1
+   |
+LL | extern "C-cmse-nonsecure-entry" fn impl_trait(_: impl Copy, _: u32, _: u32, _: u32) -> u64 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type
+  --> $DIR/generics.rs:15:5
+   |
+LL |     extern "C-cmse-nonsecure-entry" fn ambient_generic(_: T, _: u32, _: u32, _: u32) -> u64 {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type
+  --> $DIR/generics.rs:20:5
+   |
+LL | /     extern "C-cmse-nonsecure-entry" fn ambient_generic_nested(
+LL | |
+LL | |         _: Wrapper<T>,
+LL | |         _: u32,
+LL | |         _: u32,
+LL | |         _: u32,
+LL | |     ) -> u64 {
+   | |____________^
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/generics.rs:52:67
+   |
+LL | extern "C-cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trait {
+   |                                                                   ^^^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/generics.rs:59:6
+   |
+LL | ) -> &'static dyn Trait {
+   |      ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/generics.rs:69:6
+   |
+LL | ) -> WrapperTransparent {
+   |      ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error: requires `va_list` lang_item
+  --> $DIR/generics.rs:74:55
+   |
+LL | extern "C-cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
+   |                                                       ^^^^^^
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0798`.
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs
deleted file mode 100644
index de6888fae62..00000000000
--- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-//@ build-pass
-//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
-//@ needs-llvm-components: arm
-#![feature(cmse_nonsecure_entry, no_core, lang_items)]
-#![no_core]
-#![crate_type = "lib"]
-#[lang = "sized"]
-trait Sized {}
-#[lang = "copy"]
-trait Copy {}
-impl Copy for u32 {}
-
-#[no_mangle]
-pub extern "C-cmse-nonsecure-entry" fn entry_function(_: u32, _: u32, _: u32, d: u32) -> u32 {
-    d
-}
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs
deleted file mode 100644
index 4413c461c04..00000000000
--- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-//@ build-fail
-//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
-//@ needs-llvm-components: arm
-#![feature(cmse_nonsecure_entry, no_core, lang_items)]
-#![no_core]
-#[lang = "sized"]
-trait Sized {}
-#[lang = "copy"]
-trait Copy {}
-impl Copy for u32 {}
-
-#[no_mangle]
-pub extern "C-cmse-nonsecure-entry" fn entry_function(
-    _: u32,
-    _: u32,
-    _: u32,
-    _: u32,
-    e: u32,
-) -> u32 {
-    e
-}
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr
deleted file mode 100644
index cfbdda509e5..00000000000
--- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr
+++ /dev/null
@@ -1,4 +0,0 @@
-error: <unknown>:0:0: in function entry_function i32 (i32, i32, i32, i32, i32): secure entry function requires arguments on stack
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs
new file mode 100644
index 00000000000..572d792d5a5
--- /dev/null
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs
@@ -0,0 +1,26 @@
+//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
+//@ needs-llvm-components: arm
+#![feature(cmse_nonsecure_entry, no_core, lang_items)]
+#![no_core]
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+impl Copy for u32 {}
+
+#[repr(C, align(16))]
+#[allow(unused)]
+pub struct AlignRelevant(u32);
+
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn f1(_: u32, _: u32, _: u32, _: u32, _: u32, _: u32) {} //~ ERROR [E0798]
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn f2(_: u32, _: u32, _: u32, _: u16, _: u16) {} //~ ERROR [E0798]
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn f3(_: u32, _: u64, _: u32) {} //~ ERROR [E0798]
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {} //~ ERROR [E0798]
+
+#[no_mangle]
+#[allow(improper_ctypes_definitions)]
+pub extern "C-cmse-nonsecure-entry" fn f5(_: [u32; 5]) {} //~ ERROR [E0798]
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr
new file mode 100644
index 00000000000..b77e64c6bfb
--- /dev/null
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr
@@ -0,0 +1,43 @@
+error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/params-via-stack.rs:16:78
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f1(_: u32, _: u32, _: u32, _: u32, _: u32, _: u32) {}
+   |                                                                              ^^^^^^^^^^^ these arguments don't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
+
+error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/params-via-stack.rs:18:78
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f2(_: u32, _: u32, _: u32, _: u16, _: u16) {}
+   |                                                                              ^^^ this argument doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
+
+error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/params-via-stack.rs:20:62
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f3(_: u32, _: u64, _: u32) {}
+   |                                                              ^^^ this argument doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
+
+error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/params-via-stack.rs:22:64
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {}
+   |                                                                ^^^ this argument doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
+
+error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/params-via-stack.rs:26:46
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f5(_: [u32; 5]) {}
+   |                                              ^^^^^^^^ this argument doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0798`.
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs
new file mode 100644
index 00000000000..5746d14f9b1
--- /dev/null
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs
@@ -0,0 +1,84 @@
+//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
+//@ needs-llvm-components: arm
+#![feature(cmse_nonsecure_entry, no_core, lang_items)]
+#![no_core]
+#[lang = "sized"]
+pub trait Sized {}
+#[lang = "copy"]
+pub trait Copy {}
+impl Copy for u32 {}
+impl Copy for u8 {}
+
+#[repr(C)]
+pub struct ReprCU64(u64);
+
+#[repr(C)]
+pub struct ReprCBytes(u8, u8, u8, u8, u8);
+
+#[repr(C)]
+pub struct U64Compound(u32, u32);
+
+#[repr(C, align(16))]
+pub struct ReprCAlign16(u16);
+
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 {
+    //~^ ERROR [E0798]
+    ReprCU64(0)
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes {
+    //~^ ERROR [E0798]
+    ReprCBytes(0, 1, 2, 3, 4)
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound {
+    //~^ ERROR [E0798]
+    U64Compound(2, 3)
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 {
+    //~^ ERROR [E0798]
+    ReprCAlign16(4)
+}
+
+#[no_mangle]
+#[allow(improper_ctypes_definitions)]
+pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] {
+    //~^ ERROR [E0798]
+    [0xAA; 5]
+}
+#[no_mangle]
+#[allow(improper_ctypes_definitions)]
+pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 {
+    //~^ ERROR [E0798]
+    123
+}
+#[no_mangle]
+#[allow(improper_ctypes_definitions)]
+pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 {
+    //~^ ERROR [E0798]
+    456
+}
+
+#[repr(Rust)]
+pub union ReprRustUnionU64 {
+    _unused: u64,
+}
+
+#[repr(C)]
+pub union ReprCUnionU64 {
+    _unused: u64,
+}
+
+#[no_mangle]
+#[allow(improper_ctypes_definitions)]
+pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 {
+    //~^ ERROR [E0798]
+    ReprRustUnionU64 { _unused: 1 }
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn union_c() -> ReprCUnionU64 {
+    //~^ ERROR [E0798]
+    ReprCUnionU64 { _unused: 2 }
+}
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr
new file mode 100644
index 00000000000..9c885d95318
--- /dev/null
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr
@@ -0,0 +1,84 @@
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:25:48
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 {
+   |                                                ^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:30:48
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes {
+   |                                                ^^^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:35:48
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound {
+   |                                                ^^^^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:40:48
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 {
+   |                                                ^^^^^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:47:48
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] {
+   |                                                ^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:53:50
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 {
+   |                                                  ^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:59:50
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 {
+   |                                                  ^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:76:56
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 {
+   |                                                        ^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers
+  --> $DIR/return-via-stack.rs:81:53
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn union_c() -> ReprCUnionU64 {
+   |                                                     ^^^^^^^^^^^^^ this type doesn't fit in the available registers
+   |
+   = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass their result via the available return registers
+   = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0798`.
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr
new file mode 100644
index 00000000000..77379f7049d
--- /dev/null
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr
@@ -0,0 +1,9 @@
+error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target
+  --> $DIR/trustzone-only.rs:5:1
+   |
+LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0570`.
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs
new file mode 100644
index 00000000000..8978b35d356
--- /dev/null
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs
@@ -0,0 +1,89 @@
+//@ build-pass
+//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
+//@ needs-llvm-components: arm
+#![feature(cmse_nonsecure_entry, no_core, lang_items)]
+#![no_core]
+#![crate_type = "lib"]
+#[lang = "sized"]
+pub trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+impl Copy for u32 {}
+impl Copy for u8 {}
+
+#[repr(transparent)]
+pub struct ReprTransparentStruct<T> {
+    _marker1: (),
+    _marker2: (),
+    field: T,
+    _marker3: (),
+}
+
+#[repr(transparent)]
+pub enum ReprTransparentEnumU64 {
+    A(u64),
+}
+
+#[repr(C)]
+pub struct U32Compound(u16, u16);
+
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn inputs1() {}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn inputs2(_: u32, _: u32, _: u32, _: u32) {}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn inputs3(_: u64, _: u64) {}
+#[no_mangle]
+#[allow(improper_ctypes_definitions)]
+pub extern "C-cmse-nonsecure-entry" fn inputs4(_: u128) {}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn inputs5(_: f64, _: f32, _: f32) {}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn inputs6(_: ReprTransparentStruct<u64>, _: U32Compound) {}
+#[no_mangle]
+#[allow(improper_ctypes_definitions)]
+pub extern "C-cmse-nonsecure-entry" fn inputs7(_: [u32; 4]) {}
+
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn outputs1() -> u32 {
+    0
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn outputs2() -> u64 {
+    0
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn outputs3() -> i64 {
+    0
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn outputs4() -> f64 {
+    0.0
+}
+#[no_mangle]
+#[allow(improper_ctypes_definitions)]
+pub extern "C-cmse-nonsecure-entry" fn outputs5() -> [u8; 4] {
+    [0xAA; 4]
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn outputs6() -> ReprTransparentStruct<u64> {
+    ReprTransparentStruct { _marker1: (), _marker2: (), field: 0xAA, _marker3: () }
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn outputs7(
+) -> ReprTransparentStruct<ReprTransparentStruct<u64>> {
+    ReprTransparentStruct {
+        _marker1: (),
+        _marker2: (),
+        field: ReprTransparentStruct { _marker1: (), _marker2: (), field: 0xAA, _marker3: () },
+        _marker3: (),
+    }
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn outputs8() -> ReprTransparentEnumU64 {
+    ReprTransparentEnumU64::A(0)
+}
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn outputs9() -> U32Compound {
+    U32Compound(1, 2)
+}
diff --git a/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs b/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs
index 3382504af9d..4624faf1e53 100644
--- a/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs
+++ b/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs
@@ -1,4 +1,4 @@
-#![allow(dead_code, incomplete_features)]
+#![allow(dead_code)]
 
 use std::pin::Pin;
 
@@ -9,10 +9,13 @@ impl Foo {
     }
 }
 
-fn foo(_: Pin<&mut Foo>) {
+fn foo(x: Pin<&mut Foo>) {
+    let _y: &pin mut Foo = x; //~ ERROR pinned reference syntax is experimental
 }
 
-fn bar(mut x: Pin<&mut Foo>) {
+fn foo_sugar(_: &pin mut Foo) {} //~ ERROR pinned reference syntax is experimental
+
+fn bar(x: Pin<&mut Foo>) {
     foo(x);
     foo(x); //~ ERROR use of moved value: `x`
 }
@@ -22,4 +25,6 @@ fn baz(mut x: Pin<&mut Foo>) {
     x.foo(); //~ ERROR use of moved value: `x`
 }
 
+fn baz_sugar(_: &pin const Foo) {} //~ ERROR pinned reference syntax is experimental
+
 fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr b/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr
index 430b7866241..dd93a7be1ad 100644
--- a/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr
+++ b/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr
@@ -1,8 +1,38 @@
+error[E0658]: pinned reference syntax is experimental
+  --> $DIR/feature-gate-pin_ergonomics.rs:13:14
+   |
+LL |     let _y: &pin mut Foo = x;
+   |              ^^^
+   |
+   = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information
+   = help: add `#![feature(pin_ergonomics)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: pinned reference syntax is experimental
+  --> $DIR/feature-gate-pin_ergonomics.rs:16:18
+   |
+LL | fn foo_sugar(_: &pin mut Foo) {}
+   |                  ^^^
+   |
+   = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information
+   = help: add `#![feature(pin_ergonomics)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: pinned reference syntax is experimental
+  --> $DIR/feature-gate-pin_ergonomics.rs:28:18
+   |
+LL | fn baz_sugar(_: &pin const Foo) {}
+   |                  ^^^
+   |
+   = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information
+   = help: add `#![feature(pin_ergonomics)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
 error[E0382]: use of moved value: `x`
-  --> $DIR/feature-gate-pin_ergonomics.rs:17:9
+  --> $DIR/feature-gate-pin_ergonomics.rs:20:9
    |
-LL | fn bar(mut x: Pin<&mut Foo>) {
-   |        ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait
+LL | fn bar(x: Pin<&mut Foo>) {
+   |        - move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait
 LL |     foo(x);
    |         - value moved here
 LL |     foo(x);
@@ -11,13 +41,13 @@ LL |     foo(x);
 note: consider changing this parameter type in function `foo` to borrow instead if owning the value isn't necessary
   --> $DIR/feature-gate-pin_ergonomics.rs:12:11
    |
-LL | fn foo(_: Pin<&mut Foo>) {
+LL | fn foo(x: Pin<&mut Foo>) {
    |    ---    ^^^^^^^^^^^^^ this parameter takes ownership of the value
    |    |
    |    in this function
 
 error[E0382]: use of moved value: `x`
-  --> $DIR/feature-gate-pin_ergonomics.rs:22:5
+  --> $DIR/feature-gate-pin_ergonomics.rs:25:5
    |
 LL | fn baz(mut x: Pin<&mut Foo>) {
    |        ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait
@@ -36,6 +66,7 @@ help: consider reborrowing the `Pin` instead of moving it
 LL |     x.as_mut().foo();
    |      +++++++++
 
-error: aborting due to 2 previous errors
+error: aborting due to 5 previous errors
 
-For more information about this error, try `rustc --explain E0382`.
+Some errors have detailed explanations: E0382, E0658.
+For more information about an error, try `rustc --explain E0382`.