about summary refs log tree commit diff
path: root/tests/codegen/function-return.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-30 15:21:09 +0000
committerbors <bors@rust-lang.org>2023-11-30 15:21:09 +0000
commitd368c4043c26800bf1d45103e482d3e9d3bf6010 (patch)
tree9500da2a806a8fa2c229e97350fe90c02bcd5f1d /tests/codegen/function-return.rs
parent33e8232b82efb5f57760fcf08045cb36b93ed8e4 (diff)
parentcd124409335f8830becb7f7ec7de1c6aa8a504e3 (diff)
downloadrust-d368c4043c26800bf1d45103e482d3e9d3bf6010.tar.gz
rust-d368c4043c26800bf1d45103e482d3e9d3bf6010.zip
Auto merge of #3197 - RalfJung:rustup, r=RalfJung
Rustup

also move some fail tests into suitable subdirectories
Diffstat (limited to 'tests/codegen/function-return.rs')
-rw-r--r--tests/codegen/function-return.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/codegen/function-return.rs b/tests/codegen/function-return.rs
new file mode 100644
index 00000000000..d832d19ac39
--- /dev/null
+++ b/tests/codegen/function-return.rs
@@ -0,0 +1,28 @@
+// Test that the `fn_ret_thunk_extern` function attribute is (not) emitted when
+// the `-Zfunction-return={keep,thunk-extern}` flag is (not) set.
+
+// revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep
+// needs-llvm-components: x86
+// compile-flags: --target x86_64-unknown-linux-gnu
+// [keep] compile-flags: -Zfunction-return=keep
+// [thunk-extern] compile-flags: -Zfunction-return=thunk-extern
+// [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern
+// [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep
+
+#![crate_type = "lib"]
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}
+
+#[no_mangle]
+pub fn foo() {
+    // CHECK: @foo() unnamed_addr #0
+
+    // unset-NOT: fn_ret_thunk_extern
+    // keep-NOT: fn_ret_thunk_extern
+    // thunk-extern: attributes #0 = { {{.*}}fn_ret_thunk_extern{{.*}} }
+    // keep-thunk-extern: attributes #0 = { {{.*}}fn_ret_thunk_extern{{.*}} }
+    // thunk-extern-keep-NOT: fn_ret_thunk_extern
+}