about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-21 10:53:25 +0200
committerGitHub <noreply@github.com>2025-06-21 10:53:25 +0200
commit504092f415b7182405b6d18a7a2c5705e56b8db4 (patch)
tree5a1cd91e70ec32cd19dd097f28066759cea33525 /tests/codegen
parent5f727066d83ec5c54e11933833228a5e210ade1b (diff)
parenta32d0856804e75953144ac5173f06894e55ed846 (diff)
downloadrust-504092f415b7182405b6d18a7a2c5705e56b8db4.tar.gz
rust-504092f415b7182405b6d18a7a2c5705e56b8db4.zip
Rollup merge of #142597 - folkertdev:abi-cannot-be-called, r=workingjubilee
error on calls to ABIs that cannot be called

We recently added `extern "custom"`, which cannot be called using a rust call expression. But there are more ABIs that can't be called in that way, because the call does not semantically make sense.

More details are in https://github.com/rust-lang/rust/issues/140566#issuecomment-2846205457

r? `@workingjubilee`

try-job: x86_64-gnu-llvm-19-3
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/naked-asan.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/codegen/naked-asan.rs b/tests/codegen/naked-asan.rs
index 223c41b15bb..46218cf79d6 100644
--- a/tests/codegen/naked-asan.rs
+++ b/tests/codegen/naked-asan.rs
@@ -1,22 +1,28 @@
-// Make sure we do not request sanitizers for naked functions.
+//@ add-core-stubs
+//@ needs-llvm-components: x86
+//@ compile-flags: --target x86_64-unknown-linux-gnu -Zsanitizer=address -Ctarget-feature=-crt-static
 
-//@ only-x86_64
-//@ needs-sanitizer-address
-//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
+// Make sure we do not request sanitizers for naked functions.
 
 #![crate_type = "lib"]
+#![feature(no_core)]
 #![no_std]
+#![no_core]
 #![feature(abi_x86_interrupt)]
 
+extern crate minicore;
+use minicore::*;
+
+#[no_mangle]
 pub fn caller() {
-    page_fault_handler(1, 2);
+    unsafe { asm!("call {}", sym page_fault_handler) }
 }
 
-// CHECK: declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64{{.*}}){{.*}}#[[ATTRS:[0-9]+]]
+// CHECK: declare x86_intrcc void @page_fault_handler(){{.*}}#[[ATTRS:[0-9]+]]
 #[unsafe(naked)]
 #[no_mangle]
-pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) {
-    core::arch::naked_asm!("ud2")
+pub extern "x86-interrupt" fn page_fault_handler() {
+    naked_asm!("ud2")
 }
 
 // CHECK: #[[ATTRS]] =