about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2025-06-24 15:14:33 -0700
committerJubilee Young <workingjubilee@gmail.com>2025-06-25 00:54:02 -0700
commit12d05d868fd43d6d930d7d9f9648ae7443751003 (patch)
tree81564a0c27dd5a9956fb313a797e031cfb2089fe
parent586a9d1c25f7ff33797283e35195fdfa38cf53b2 (diff)
downloadrust-12d05d868fd43d6d930d7d9f9648ae7443751003.tar.gz
rust-12d05d868fd43d6d930d7d9f9648ae7443751003.zip
tests: migrate unsupported-abi-transmute.rs to extern "rust-invalid"
-rw-r--r--tests/ui/abi/unsupported-abi-transmute.rs15
-rw-r--r--tests/ui/abi/unsupported-abi-transmute.stderr8
-rw-r--r--tests/ui/abi/unsupported-in-impls.rs3
3 files changed, 13 insertions, 13 deletions
diff --git a/tests/ui/abi/unsupported-abi-transmute.rs b/tests/ui/abi/unsupported-abi-transmute.rs
index 31501bc6d10..42aa180e1fd 100644
--- a/tests/ui/abi/unsupported-abi-transmute.rs
+++ b/tests/ui/abi/unsupported-abi-transmute.rs
@@ -1,15 +1,12 @@
-//@ add-core-stubs
-//@ compile-flags: --crate-type=lib --target x86_64-unknown-none
-//@ needs-llvm-components: x86
+// Check we error before unsupported ABIs reach codegen stages.
+
 //@ edition: 2018
-#![no_core]
-#![feature(no_core, lang_items)]
-extern crate minicore;
-use minicore::*;
+//@ compile-flags: --crate-type=lib
+#![feature(rustc_attrs)]
 
-// Check we error before unsupported ABIs reach codegen stages.
+use core::mem;
 
 fn anything() {
-    let a = unsafe { mem::transmute::<usize, extern "thiscall" fn(i32)>(4) }(2);
+    let a = unsafe { mem::transmute::<usize, extern "rust-invalid" fn(i32)>(4) }(2);
     //~^ ERROR: is not a supported ABI for the current target [E0570]
 }
diff --git a/tests/ui/abi/unsupported-abi-transmute.stderr b/tests/ui/abi/unsupported-abi-transmute.stderr
index 63056180c71..f1d202b1a1c 100644
--- a/tests/ui/abi/unsupported-abi-transmute.stderr
+++ b/tests/ui/abi/unsupported-abi-transmute.stderr
@@ -1,8 +1,8 @@
-error[E0570]: "thiscall" is not a supported ABI for the current target
-  --> $DIR/unsupported-abi-transmute.rs:13:53
+error[E0570]: "rust-invalid" is not a supported ABI for the current target
+  --> $DIR/unsupported-abi-transmute.rs:10:53
    |
-LL |     let a = unsafe { mem::transmute::<usize, extern "thiscall" fn(i32)>(4) }(2);
-   |                                                     ^^^^^^^^^^
+LL |     let a = unsafe { mem::transmute::<usize, extern "rust-invalid" fn(i32)>(4) }(2);
+   |                                                     ^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/abi/unsupported-in-impls.rs b/tests/ui/abi/unsupported-in-impls.rs
index 65a79e7643c..71797954865 100644
--- a/tests/ui/abi/unsupported-in-impls.rs
+++ b/tests/ui/abi/unsupported-in-impls.rs
@@ -1,6 +1,9 @@
 // Test for https://github.com/rust-lang/rust/issues/86232
 // Due to AST-to-HIR lowering nuances, we used to allow unsupported ABIs to "leak" into the HIR
 // without being checked, as we would check after generating the ExternAbi.
+// Checking afterwards only works if we examine every HIR construct that contains an ExternAbi,
+// and those may be very different in HIR, even if they read the same in source.
+// This made it very easy to make mistakes.
 //
 // Here we test that an unsupported ABI in various impl-related positions will be rejected,
 // both in the original declarations and the actual implementations.