Repository: rust-lang/rust
Pull request #135808: Implement Display for ``rustc_target::callconv::Conv``
Author: login: tiif
Labels: name: T-compiler
description: Relevant to the compiler team, which will review and decide on the PR/issue.
name: S-waiting-on-bors
description: Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Created: 2025-01-21T09:00:19Z | Merged: 2025-05-17T19:30:38Z

Follow up of https://github.com/rust-lang/rust/pull/133103#discussion_r1885552854



Diff:
diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs
index 29f819cca1fb6..35e2518770179 100644
--- a/compiler/rustc_const_eval/src/interpret/call.rs
+++ b/compiler/rustc_const_eval/src/interpret/call.rs
@@ -353,8 +353,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
         if caller_fn_abi.conv != callee_fn_abi.conv {
             throw_ub_custom!(
                 fluent::const_eval_incompatible_calling_conventions,
-                callee_conv = format!("{:?}", callee_fn_abi.conv),
-                caller_conv = format!("{:?}", caller_fn_abi.conv),
+                callee_conv = format!("{}", callee_fn_abi.conv),
+                caller_conv = format!("{}", caller_fn_abi.conv),
             )
         }
 
diff --git a/compiler/rustc_target/src/callconv/mod.rs b/compiler/rustc_target/src/callconv/mod.rs
index 6d0ee3c7ee58a..a141accb73802 100644
--- a/compiler/rustc_target/src/callconv/mod.rs
+++ b/compiler/rustc_target/src/callconv/mod.rs
@@ -1,3 +1,4 @@
+use std::fmt::Display;
 use std::str::FromStr;
 use std::{fmt, iter};
 
@@ -897,6 +898,37 @@ impl FromStr for Conv {
     }
 }
 
+fn conv_to_externabi(conv: &Conv) -> ExternAbi {
+    match conv {
+        Conv::C => ExternAbi::C { unwind: false },
+        Conv::Rust => ExternAbi::Rust,
+        Conv::PreserveMost => ExternAbi::RustCold,
+        Conv::ArmAapcs => ExternAbi::Aapcs { unwind: false },
+        Conv::CCmseNonSecureCall => ExternAbi::CCmseNonSecureCall,
+        Conv::CCmseNonSecureEntry => ExternAbi::CCmseNonSecureEntry,
+        Conv::Msp430Intr => ExternAbi::Msp430Interrupt,
+        Conv::GpuKernel => ExternAbi::GpuKernel,
+        Conv::X86Fastcall => ExternAbi::Fastcall { unwind: false },
+        Conv::X86Intr => ExternAbi::X86Interrupt,
+        Conv::X86Stdcall => ExternAbi::Stdcall { unwind: false },
+        Conv::X86ThisCall => ExternAbi::Thiscall { unwind: false },
+        Conv::X86VectorCall => ExternAbi::Vectorcall { unwind: false },
+        Conv::X86_64SysV => ExternAbi::SysV64 { unwind: false },
+        Conv::X86_64Win64 => ExternAbi::Win64 { unwind: false },
+        Conv::AvrInterrupt => ExternAbi::AvrInterrupt,
+        Conv::AvrNonBlockingInterrupt => ExternAbi::AvrNonBlockingInterrupt,
+        Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine } => ExternAbi::RiscvInterruptM,
+        Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor } => ExternAbi::RiscvInterruptS,
+        Conv::Cold | Conv::PreserveAll => unreachable!(),
+    }
+}
+
+impl Display for Conv {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "{}", conv_to_externabi(self))
+    }
+}
+
 // Some types are used a lot. Make sure they don't unintentionally get bigger.
 #[cfg(target_pointer_width = "64")]
 mod size_asserts {
diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs
index 12e7d0f1a62cf..04829a9424c13 100644
--- a/src/tools/miri/src/helpers.rs
+++ b/src/tools/miri/src/helpers.rs
@@ -928,12 +928,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
         self.read_c_str_with_char_size(ptr, wchar_t.size, wchar_t.align.abi)
     }
 
-    /// Check that the ABI is what we expect.
-    fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
+    /// Check that the calling convention is what we expect.
+    fn check_callconv<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with calling convention {exp_abi} using caller calling convention {}",
                 fn_abi.conv
             );
         }
@@ -969,7 +968,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
         exp_abi: Conv,
         link_name: Symbol,
     ) -> InterpResult<'tcx, ()> {
-        self.check_abi(abi, exp_abi)?;
+        self.check_callconv(abi, exp_abi)?;
         if let Some((body, instance)) = self.eval_context_mut().lookup_exported_symbol(link_name)? {
             // If compiler-builtins is providing the symbol, then don't treat it as a clash.
             // We'll use our built-in implementation in `emulate_foreign_item_inner` for increased
diff --git a/src/tools/miri/tests/fail/function_calls/check_arg_abi.rs b/src/tools/miri/tests/fail/function_calls/check_arg_abi.rs
index ffa0443ce507a..0e91636416903 100644
--- a/src/tools/miri/tests/fail/function_calls/check_arg_abi.rs
+++ b/src/tools/miri/tests/fail/function_calls/check_arg_abi.rs
@@ -4,6 +4,6 @@ fn main() {
     }
 
     unsafe {
-        let _ = malloc(0); //~ ERROR: calling a function with ABI C using caller ABI Rust
+        let _ = malloc(0); //~ ERROR: calling a function with calling convention "C" using caller calling convention "Rust"
     };
 }
diff --git a/src/tools/miri/tests/fail/function_calls/check_arg_abi.stderr b/src/tools/miri/tests/fail/function_calls/check_arg_abi.stderr
index bf1fbb7721f1f..7873018292316 100644
--- a/src/tools/miri/tests/fail/function_calls/check_arg_abi.stderr
+++ b/src/tools/miri/tests/fail/function_calls/check_arg_abi.stderr
@@ -1,8 +1,8 @@
-error: Undefined Behavior: calling a function with ABI C using caller ABI Rust
+error: Undefined Behavior: calling a function with calling convention "C" using caller calling convention "Rust"
   --> tests/fail/function_calls/check_arg_abi.rs:LL:CC
    |
 LL |         let _ = malloc(0);
-   |                 ^^^^^^^^^ calling a function with ABI C using caller ABI Rust
+   |                 ^^^^^^^^^ calling a function with calling convention "C" using caller calling convention "Rust"
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
diff --git a/src/tools/miri/tests/fail/function_calls/check_callback_abi.rs b/src/tools/miri/tests/fail/function_calls/check_callback_abi.rs
index 6a7a26710d16b..177e38105e6fa 100644
--- a/src/tools/miri/tests/fail/function_calls/check_callback_abi.rs
+++ b/src/tools/miri/tests/fail/function_calls/check_callback_abi.rs
@@ -9,7 +9,7 @@ fn main() {
         // Make sure we check the ABI when Miri itself invokes a function
         // as part of a shim implementation.
         std::intrinsics::catch_unwind(
-            //~^ ERROR: calling a function with calling convention C using calling convention Rust
+            //~^ ERROR: calling a function with calling convention "C" using calling convention "Rust"
             std::mem::transmute::<extern "C" fn(*mut u8), _>(try_fn),
             std::ptr::null_mut(),
             |_, _| unreachable!(),
diff --git a/src/tools/miri/tests/fail/function_calls/check_callback_abi.stderr b/src/tools/miri/tests/fail/function_calls/check_callback_abi.stderr
index 6b0692e1c6e8d..20182ac923677 100644
--- a/src/tools/miri/tests/fail/function_calls/check_callback_abi.stderr
+++ b/src/tools/miri/tests/fail/function_calls/check_callback_abi.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with calling convention C using calling convention Rust
+error: Undefined Behavior: calling a function with calling convention "C" using calling convention "Rust"
   --> tests/fail/function_calls/check_callback_abi.rs:LL:CC
    |
 LL | /         std::intrinsics::catch_unwind(
@@ -7,7 +7,7 @@ LL | |             std::mem::transmute::<extern "C" fn(*mut u8), _>(try_fn),
 LL | |             std::ptr::null_mut(),
 LL | |             |_, _| unreachable!(),
 LL | |         );
-   | |_________^ calling a function with calling convention C using calling convention Rust
+   | |_________^ calling a function with calling convention "C" using calling convention "Rust"
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.cache.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.cache.stderr
index e4302ad1d3a53..46a32d1487ead 100644
--- a/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.cache.stderr
+++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.cache.stderr
@@ -1,8 +1,8 @@
-error: Undefined Behavior: calling a function with calling convention Rust using calling convention C
+error: Undefined Behavior: calling a function with calling convention "Rust" using calling convention "C"
   --> tests/fail/function_calls/exported_symbol_abi_mismatch.rs:LL:CC
    |
 LL |             foo();
-   |             ^^^^^ calling a function with calling convention Rust using calling convention C
+   |             ^^^^^ calling a function with calling convention "Rust" using calling convention "C"
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.fn_ptr.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.fn_ptr.stderr
index 9f40c48b338e3..3872528991905 100644
--- a/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.fn_ptr.stderr
+++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.fn_ptr.stderr
@@ -1,8 +1,8 @@
-error: Undefined Behavior: calling a function with calling convention Rust using calling convention C
+error: Undefined Behavior: calling a function with calling convention "Rust" using calling convention "C"
   --> tests/fail/function_calls/exported_symbol_abi_mismatch.rs:LL:CC
    |
 LL |         std::mem::transmute::<unsafe fn(), unsafe extern "C" fn()>(foo)();
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention Rust using calling convention C
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention "Rust" using calling convention "C"
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.no_cache.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.no_cache.stderr
index e4302ad1d3a53..46a32d1487ead 100644
--- a/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.no_cache.stderr
+++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.no_cache.stderr
@@ -1,8 +1,8 @@
-error: Undefined Behavior: calling a function with calling convention Rust using calling convention C
+error: Undefined Behavior: calling a function with calling convention "Rust" using calling convention "C"
   --> tests/fail/function_calls/exported_symbol_abi_mismatch.rs:LL:CC
    |
 LL |             foo();
-   |             ^^^^^ calling a function with calling convention Rust using calling convention C
+   |             ^^^^^ calling a function with calling convention "Rust" using calling convention "C"
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.rs b/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.rs
index 50a0e8e6edef8..1950e162c0700 100644
--- a/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.rs
+++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.rs
@@ -12,7 +12,7 @@ fn main() {
     #[cfg(fn_ptr)]
     unsafe {
         std::mem::transmute::<unsafe fn(), unsafe extern "C" fn()>(foo)();
-        //~[fn_ptr]^ ERROR: calling a function with calling convention Rust using calling convention C
+        //~[fn_ptr]^ ERROR: calling a function with calling convention "Rust" using calling convention "C"
     }
 
     // `Instance` caching should not suppress ABI check.
@@ -28,8 +28,8 @@ fn main() {
         }
         unsafe {
             foo();
-            //~[no_cache]^ ERROR: calling a function with calling convention Rust using calling convention C
-            //~[cache]| ERROR: calling a function with calling convention Rust using calling convention C
+            //~[no_cache]^ ERROR: calling a function with calling convention "Rust" using calling convention "C"
+            //~[cache]| ERROR: calling a function with calling convention "Rust" using calling convention "C"
         }
     }
 }
diff --git a/src/tools/miri/tests/fail/tail_calls/cc-mismatch.rs b/src/tools/miri/tests/fail/tail_calls/cc-mismatch.rs
index 5f00dbf257366..952f9697fc795 100644
--- a/src/tools/miri/tests/fail/tail_calls/cc-mismatch.rs
+++ b/src/tools/miri/tests/fail/tail_calls/cc-mismatch.rs
@@ -1,4 +1,4 @@
-//@error-in-other-file: Undefined Behavior: calling a function with calling convention C using calling convention Rust
+//@error-in-other-file: Undefined Behavior: calling a function with calling convention "C" using calling convention "Rust"
 #![feature(explicit_tail_calls)]
 #![allow(incomplete_features)]
 
diff --git a/src/tools/miri/tests/fail/tail_calls/cc-mismatch.stderr b/src/tools/miri/tests/fail/tail_calls/cc-mismatch.stderr
index 5061c9e8dc3f0..61ddea644720f 100644
--- a/src/tools/miri/tests/fail/tail_calls/cc-mismatch.stderr
+++ b/src/tools/miri/tests/fail/tail_calls/cc-mismatch.stderr
@@ -1,8 +1,8 @@
-error: Undefined Behavior: calling a function with calling convention C using calling convention Rust
+error: Undefined Behavior: calling a function with calling convention "C" using calling convention "Rust"
   --> RUSTLIB/core/src/ops/function.rs:LL:CC
    |
 LL |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention C using calling convention Rust
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention "C" using calling convention "Rust"
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
diff --git a/tests/ui/consts/miri_unleashed/abi-mismatch.rs b/tests/ui/consts/miri_unleashed/abi-mismatch.rs
index ea640ae78d551..727cfecfa4165 100644
--- a/tests/ui/consts/miri_unleashed/abi-mismatch.rs
+++ b/tests/ui/consts/miri_unleashed/abi-mismatch.rs
@@ -10,6 +10,6 @@ const fn call_rust_fn(my_fn: extern "Rust" fn()) {
 
 static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
 //~^ ERROR could not evaluate static initializer
-//~| NOTE calling a function with calling convention C using calling convention Rust
+//~| NOTE calling a function with calling convention "C" using calling convention "Rust"
 
 fn main() {}
diff --git a/tests/ui/consts/miri_unleashed/abi-mismatch.stderr b/tests/ui/consts/miri_unleashed/abi-mismatch.stderr
index 88623b134b0bf..7d1fdcce52614 100644
--- a/tests/ui/consts/miri_unleashed/abi-mismatch.stderr
+++ b/tests/ui/consts/miri_unleashed/abi-mismatch.stderr
@@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
   --> $DIR/abi-mismatch.rs:11:18
    |
 LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention C using calling convention Rust
+   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention "C" using calling convention "Rust"
    |
 note: inside `call_rust_fn`
   --> $DIR/abi-mismatch.rs:7:5


Reviews:
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-21T10:34:30Z
user: login: RalfJung
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-21T13:45:42Z
user: login: tiif
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-21T16:23:55Z
user: login: RalfJung
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-21T17:04:04Z
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-21T20:58:26Z
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-21T21:00:27Z
user: login: RalfJung
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-21T21:37:02Z
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-22T00:09:41Z
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-22T00:15:14Z
user: login: RalfJung
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-22T00:20:14Z
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-22T01:11:51Z
user: login: RalfJung
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-22T02:09:01Z
user: login: tiif
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-22T07:32:12Z
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-01-22T19:24:52Z
user: login: oli-obk
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-03T14:46:51Z
user: login: tiif
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-09T16:54:19Z
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-09T21:52:12Z
user: login: workingjubilee
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-09T21:57:25Z
user: login: tiif
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-10T00:15:39Z
user: login: tiif
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-11T16:50:10Z
user: login: bjorn3
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-10T13:07:14Z
user: login: bjorn3
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-10T13:08:34Z
user: login: tiif
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-12T07:23:09Z

Review comments:
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: @oli-obk This error is user-facing, correct?

If so, the proposed formatting is not desirable, it should be using [ExternAbi](https://github.com/rust-lang/rust/blob/ebbe63891f1fae21734cb97f2f863b08b1d44bf8/compiler/rustc_abi/src/extern_abi/mod.rs)'s formatting instead.
created_at: 2025-01-21T10:34:29Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: RalfJung
body: This isn't about `ExternAbi` though, it is about the underlying calling convention.
created_at: 2025-01-21T13:45:42Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: tiif
body: I hope it'd help by providing more context. Initially we indeed used ``ExternAbi`` here for ``check_abi``, but after https://github.com/rust-lang/rust/pull/133103 we passed ``FnAbi`` instead of ``ExternAbi``, so we can check the number of fixed args like what is done in https://github.com/rust-lang/miri/pull/4122. 
created_at: 2025-01-21T16:23:55Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: RalfJung
body: Also, this is how we allow e.g. calling a `C` function through a `C-unwind` fn pointer.
created_at: 2025-01-21T17:04:04Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: > This isn't about ExternAbi though, it is about the underlying calling convention.

The underlying calling convention is still mappable to one of the ExternAbi strings, and we can still express conflicts in terms of that. Dropping data randomly, like erasing "rust-cold" to "Cold", or "x86-interrupt" to "X86Intr", will mostly be confusing.
created_at: 2025-01-21T20:58:26Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: You should express the error in a format that a programmer can understand and act on, using the vocabulary they already have access to. Do not make them guess or infer what you mean.
created_at: 2025-01-21T21:00:27Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: RalfJung
body: The mapping from ExternAbi to Conv is target-specific and non-injective. I don't think there is a good way to map this back. "The ABI string in the surface language" and "the underlying calling convention" are just fundamentally different concepts. We AFAIK currently have no documentation for the latter, but that's a documentation issue, not a Miri issue.

Anyway this is pre-existing so I don't think it should block this PR.
created_at: 2025-01-21T21:37:02Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: The diff is almost non-operative, as-is, which means there's not really a reason to accept it. Where is the UI test for this error?
created_at: 2025-01-22T00:09:41Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: A non-injective mapping can still be expressed by giving the set of valid inputs that would make the ABIs match. The real set is very small, and half of these "ABIs" should not be possible to call from Rust functions.
created_at: 2025-01-22T00:15:14Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: RalfJung
body: The concrete error this comment is attached to does not have a ui test; the other one changed in this PR is tested at

https://github.com/rust-lang/rust/blob/522af10cccd9c23f5147d123cd6373ae0aa0795d/src/tools/miri/tests/fail/function_calls/check_callback_abi.rs#L12

and

https://github.com/rust-lang/rust/blob/e8ff9b1836fc8e69ab4fe78c35a6799277c8e700/src/tools/miri/tests/fail/function_calls/exported_symbol_abi_mismatch.rs
created_at: 2025-01-22T00:20:13Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: huh, those two say "calling convention" but this error says "ABI"? is that what you mean by "the concrete error"... does not have a UI test?
created_at: 2025-01-22T01:11:51Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: RalfJung
body: Yeah this one here is triggered when you call a built-in shim the wrong way (rather than some normal Rust function), which we don't have a test for. We should add one.

And indeed it should say "calling convention".
created_at: 2025-01-22T02:09:01Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: tiif
body: So we should change  the error message in ``check_abi``to use "calling convention" and add a test that will invoke the ``check_abi`` here. 

Other than that, should we continue with ``impl Display for Conv`` or map the calling convention to ``ExternAbi``?
created_at: 2025-01-22T07:32:12Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: Please implement Display by mapping Conv back to the matching ExternAbi variant (without `unwind`). This will sometimes give a surprising result, but it will still be comprehensible. If this is properly tested, then I can elaborate on the error message in a followup that gives the rest of the information necessary to fix the problem.

Of course, if even this is considered impossible by my peers, then I can relent for now and simply make possible the impossible later.
created_at: 2025-01-22T19:24:52Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,11 @@
+extern "Rust" {
+    fn pipe(fds: *mut std::ffi::c_int) -> std::ffi::c_int;
+}
+
+// Test the error for calling convention mismatch. 
+fn main() {
+    let mut fds = [-1, -1];
+    let res = unsafe { pipe(fds.as_mut_ptr()) };
+    //~^ ERROR: calling a function with calling convention C using caller calling convention Rust
+    assert_eq!(res, 0);
+}
path: src/tools/miri/tests/fail/shims/callconv_mismatch.rs
user: login: oli-obk
body: missing trailing newline
created_at: 2025-02-03T14:46:51Z
author_association: CONTRIBUTOR
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: tiif
body: According to [conv_from_spec_abi](https://github.com/rust-lang/rust/blob/ed897d5f85d61d56a7d52b180e34c8ca62b59e30/compiler/rustc_ty_utils/src/abi.rs#L269), the reverse mapping of ``Conv::Rust`` can potentially be ``ExternAbi::RustIntrinsic / RustCall / Rust``. Similarly, ``Conv::C`` can be mapped to ``ExternAbi::C / Unadjusted / Cdecl``. 

Also, in [adjust_abi](https://github.com/rust-lang/rust/blob/ed897d5f85d61d56a7d52b180e34c8ca62b59e30/compiler/rustc_target/src/spec/mod.rs#L2910), ``ExternAbi::StdCall / Thiscall / Fastcall / VectorCall`` can occasionally get mapped to ``ExternAbi::C``. That means the reverse mapping of ``Conv::C`` to ``ExternAbi``can possibly be any of them. 

If I ignore all of the issues above, the simplest reverse mapping that I can think of is:
-  Conv::Rust => ExternAbi::Rust
-  Conv::PreserveMost => ExternAbi::RustCold
-  Conv::X86Stdcall => ExternAbi::Stdcall
-  Conv::X86Fastcall => ExternAbi::Fastcall
-  Conv::X86VectorCall => ExternAbi::Vectorcall
-  Conv::X86ThisCall => ExternAbi::Thiscall
-  Conv::C => ExternAbi::C
-  Conv::X86_64Win64 => ExternAbi::Win64
-  Conv::X86_64SysV => ExternAbi::SysV64
-  Conv::ArmAapcs => ExternAbi::Aapcs
-  Conv::CCmseNonSecureCall => ExternAbi::CCmseNonSecureCall
-  Conv::CCmseNonSecureEntry => ExternAbi::CCmseNonSecureEntry
-  Conv::PtxKernel => ExternAbi::PtxKernel
-  Conv::Msp430Intr => ExternAbi::Msp430Interrupt
-  Conv::X86Intr => ExternAbi::X86Interrupt
-  Conv::GpuKernel => ExternAbi::GpuKernel
-  Conv::AvrInterrupt => ExternAbi::AvrInterrupt
-  Conv::AvrNonBlockingInterrupt => ExternAbi::AvrNonBlockingInterrupt
-  Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine } => ExternAbi::RiscvInterruptM
-  Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor } => ExternAbi::RiscvInterruptS
-  Conv::Cold and Conv::PreserveAll: Not sure how to deal with them, can we ignore them?

But I am not sure if this is still correct, so cc @workingjubilee for a vibe check :)


created_at: 2025-03-09T16:54:18Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: Yes. Please ignore `Conv::Cold` and `Conv::PreserveAll`, they are actually dead code. I am working through a refactor of some parts of the compiler that involve what is currently called `Conv` and discovered they are dead on the way.
created_at: 2025-03-09T21:52:12Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: workingjubilee
body: Once I am done they will also make it possible to always recover the list of valid `ExternAbi` names from the actually-used ABI.
created_at: 2025-03-09T21:57:25Z
author_association: MEMBER
diff_hunk: @@ -920,8 +920,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
         if fn_abi.conv != exp_abi {
             throw_ub_format!(
-                "calling a function with ABI {:?} using caller ABI {:?}",
-                exp_abi,
+                "calling a function with ABI {exp_abi} using caller ABI {}",
path: src/tools/miri/src/helpers.rs
user: login: tiif
body: Nice! Since there is an ongoing refactor involving ``Conv``, would it be more convenient if I put this on hold and wait for that to finish? I don't mind working on this sooner or later. 

EDIT: I went ahead and made the change anyway :)
created_at: 2025-03-10T00:15:38Z
author_association: MEMBER
path: src/tools/miri/tests/fail/function_calls/check_arg_abi.rs
user: login: tiif
body: We already have relevant test in miri, so I removed similar test in previous commit. 
created_at: 2025-03-11T16:50:09Z
author_association: MEMBER
diff_hunk: @@ -897,6 +898,37 @@ impl FromStr for Conv {
     }
 }
 
+fn conv_to_externabi(conv: &Conv) -> ExternAbi {
+    match conv {
+        Conv::C => ExternAbi::C { unwind: false },
+        Conv::Rust => ExternAbi::Rust,
+        Conv::PreserveMost => ExternAbi::RustCold,
+        Conv::ArmAapcs => ExternAbi::Aapcs { unwind: false },
+        Conv::CCmseNonSecureCall => ExternAbi::CCmseNonSecureCall,
+        Conv::CCmseNonSecureEntry => ExternAbi::CCmseNonSecureEntry,
+        Conv::Msp430Intr => ExternAbi::Msp430Interrupt,
+        Conv::GpuKernel => ExternAbi::GpuKernel,
+        Conv::X86Fastcall => ExternAbi::Fastcall { unwind: false },
+        Conv::X86Intr => ExternAbi::X86Interrupt,
+        Conv::X86Stdcall => ExternAbi::Stdcall { unwind: false },
+        Conv::X86ThisCall => ExternAbi::Thiscall { unwind: false },
+        Conv::X86VectorCall => ExternAbi::Vectorcall { unwind: false },
+        Conv::X86_64SysV => ExternAbi::SysV64 { unwind: false },
+        Conv::X86_64Win64 => ExternAbi::Win64 { unwind: false },
+        Conv::AvrInterrupt => ExternAbi::AvrInterrupt,
+        Conv::AvrNonBlockingInterrupt => ExternAbi::AvrNonBlockingInterrupt,
+        Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine } => ExternAbi::RiscvInterruptM,
+        Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor } => ExternAbi::RiscvInterruptS,
+        Conv::Cold | Conv::PreserveAll => panic!("This is deadcode"),
path: compiler/rustc_target/src/callconv/mod.rs
user: login: bjorn3
body: ```suggestion
        Conv::Cold | Conv::PreserveAll => unreachable!(),
```

also why is it unreachable?
created_at: 2025-05-10T13:07:14Z
author_association: MEMBER
diff_hunk: @@ -897,6 +898,37 @@ impl FromStr for Conv {
     }
 }
 
+fn conv_to_externabi(conv: &Conv) -> ExternAbi {
+    match conv {
+        Conv::C => ExternAbi::C { unwind: false },
path: compiler/rustc_target/src/callconv/mod.rs
user: login: bjorn3
body: This loses the distinction between `extern "C"` and `extern "C-unwind"` which could be confusing for users.

Edit: This was already discussed above.
created_at: 2025-05-10T13:08:34Z
author_association: MEMBER
diff_hunk: @@ -897,6 +898,37 @@ impl FromStr for Conv {
     }
 }
 
+fn conv_to_externabi(conv: &Conv) -> ExternAbi {
+    match conv {
+        Conv::C => ExternAbi::C { unwind: false },
+        Conv::Rust => ExternAbi::Rust,
+        Conv::PreserveMost => ExternAbi::RustCold,
+        Conv::ArmAapcs => ExternAbi::Aapcs { unwind: false },
+        Conv::CCmseNonSecureCall => ExternAbi::CCmseNonSecureCall,
+        Conv::CCmseNonSecureEntry => ExternAbi::CCmseNonSecureEntry,
+        Conv::Msp430Intr => ExternAbi::Msp430Interrupt,
+        Conv::GpuKernel => ExternAbi::GpuKernel,
+        Conv::X86Fastcall => ExternAbi::Fastcall { unwind: false },
+        Conv::X86Intr => ExternAbi::X86Interrupt,
+        Conv::X86Stdcall => ExternAbi::Stdcall { unwind: false },
+        Conv::X86ThisCall => ExternAbi::Thiscall { unwind: false },
+        Conv::X86VectorCall => ExternAbi::Vectorcall { unwind: false },
+        Conv::X86_64SysV => ExternAbi::SysV64 { unwind: false },
+        Conv::X86_64Win64 => ExternAbi::Win64 { unwind: false },
+        Conv::AvrInterrupt => ExternAbi::AvrInterrupt,
+        Conv::AvrNonBlockingInterrupt => ExternAbi::AvrNonBlockingInterrupt,
+        Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine } => ExternAbi::RiscvInterruptM,
+        Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor } => ExternAbi::RiscvInterruptS,
+        Conv::Cold | Conv::PreserveAll => panic!("This is deadcode"),
path: compiler/rustc_target/src/callconv/mod.rs
user: login: tiif
body: This is discussed in https://github.com/rust-lang/rust/pull/135808#discussion_r1986429110
created_at: 2025-05-12T07:23:09Z
author_association: MEMBER

PR comments:
user: login: rustbot
created_at: 2025-01-21T09:00:28Z
body: r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use `r?` to explicitly pick a reviewer
author_association: COLLABORATOR
user: login: rustbot
created_at: 2025-01-21T09:00:30Z
body: Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri
author_association: COLLABORATOR
user: login: tiif
created_at: 2025-01-21T09:09:19Z
body: It's miri related, and Ralf looks busy, so r? @oli-obk 
author_association: MEMBER
user: login: oli-obk
created_at: 2025-01-21T09:38:39Z
body: @bors r+ rollup

has no test changes as for almost all cases the `Debug` impl has the same output as the `Display` impl, adding a new test just for risc doesn't really bring much value imo, so shipping as is
author_association: CONTRIBUTOR
user: login: bors
created_at: 2025-01-21T09:38:42Z
body: :pushpin: Commit bbde683a8e23afa3d8e345ec2047f0c2fad8792f has been approved by `oli-obk`

It is now in the [queue](https://bors.rust-lang.org/homu/queue/rust) for this repository.

<!-- @bors r=oli-obk bbde683a8e23afa3d8e345ec2047f0c2fad8792f -->
<!-- homu: {"type":"Approved","sha":"bbde683a8e23afa3d8e345ec2047f0c2fad8792f","approver":"oli-obk","queue":"https://bors.rust-lang.org/homu/queue/rust"} -->
author_association: COLLABORATOR
user: login: oli-obk
created_at: 2025-01-21T11:29:42Z
body: @bors r-
author_association: CONTRIBUTOR
user: login: rust-log-analyzer
created_at: 2025-02-03T14:23:29Z
body: 
The job **`x86_64-gnu-tools`** failed! Check out the build log: [(web)](https://github.com/rust-lang/rust/actions/runs/13114995623/job/36587053353) [(plain)](https://github.com/rust-lang/rust/commit/74d57a5b1be4f85f493fa51a6b7f8c1dce8bd932/checks/36587053353/logs)

<details><summary><i>Click to see the possible cause of the failure (guessed by this bot)</i></summary>

```plain
tests/fail/function_calls/exported_symbol_bad_unwind2.rs (revision `definition`) ... ok
tests/fail/function_calls/exported_symbol_bad_unwind2.rs (revision `both`) ... ok

FAILED TEST: tests/fail/function_calls/check_arg_abi.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-7LbrdZ" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/miri_ui/0/tests/fail/function_calls" "tests/fail/function_calls/check_arg_abi.rs" "--edition" "2021"
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/fail/function_calls/check_arg_abi.stderr` to the actual output
--- tests/fail/function_calls/check_arg_abi.stderr
+++ <stderr output>
---
 error: aborting due to 1 previous error
 


error: `calling a function with ABI C using caller ABI Rust` not found in diagnostics on line 7
  |
  |
7 |         let _ = malloc(0); //~ ERROR: calling a function with ABI C using caller ABI Rust
  |

error: there were 1 unmatched diagnostics
##[error] --> tests/fail/function_calls/check_arg_abi.rs:7:17
##[error] --> tests/fail/function_calls/check_arg_abi.rs:7:17
  |
7 |         let _ = malloc(0); //~ ERROR: calling a function with ABI C using caller ABI Rust
  |                 ^^^^^^^^^ Error: Undefined Behavior: calling a function with calling convention C using caller calling convention Rust

FAILURES:
    tests/fail/function_calls/check_arg_abi.rs

---

Location:
   /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ui_test-0.28.0/src/lib.rs:369

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`
Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/ui-4a7e3e53a4eb956e --quiet` (exit status: 1)
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/ui-4a7e3e53a4eb956e --quiet` (exit status: 1)
Command has failed. Rerun with -v to see more details.
  local time: Mon Feb  3 14:23:17 UTC 2025
  network time: Mon, 03 Feb 2025 14:23:17 GMT
##[error]Process completed with exit code 1.
Post job cleanup.
```

</details>
        
author_association: COLLABORATOR
user: login: LFS6502
created_at: 2025-03-01T09:35:11Z
body: @tiif Thanks for your contribution. Are you able to address the code review?
author_association: CONTRIBUTOR
user: login: tiif
created_at: 2025-03-01T14:11:26Z
body: Yup, I have been planning to do this, but unfortunately I still have quite a bit of stuff on my queue, I'd convert this to draft for now. 
author_association: MEMBER
user: login: rust-log-analyzer
created_at: 2025-03-11T16:55:28Z
body: 
The job **`x86_64-gnu-llvm-18`** failed! Check out the build log: [(web)](https://github.com/rust-lang/rust/actions/runs/13793606507/job/38579660360) [(plain)](https://github.com/rust-lang/rust/commit/93c27f3be5ac5e70f44d26d7f102e0b6c9c5b92a/checks/38579660360/logs)

<details><summary><i>Click to see the possible cause of the failure (guessed by this bot)</i></summary>

```plain
#20 exporting to docker image format
#20 sending tarball 19.9s done
#20 DONE 22.8s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
   Compiling thorin-dwp v0.8.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/compiler/rustc_ast_pretty)
   Compiling rustc_next_trait_solver v0.0.0 (/checkout/compiler/rustc_next_trait_solver)
   Compiling rustc_attr_data_structures v0.0.0 (/checkout/compiler/rustc_attr_data_structures)
error[E0599]: no variant or associated item named `PtxKernel` found for enum `Conv` in the current scope
   --> compiler/rustc_target/src/callconv/mod.rs:915:15
    |
532 | pub enum Conv {
    | ------------- variant or associated item `PtxKernel` not found for this enum
...
915 |         Conv::PtxKernel => ExternAbi::PtxKernel,
    |               ^^^^^^^^^ variant or associated item not found in `Conv`
    |
help: there is a variant with a similar name
    |
915 -         Conv::PtxKernel => ExternAbi::PtxKernel,
915 +         Conv::GpuKernel => ExternAbi::PtxKernel,
    |

For more information about this error, try `rustc --explain E0599`.
error: could not compile `rustc_target` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
```

</details>
        
author_association: COLLABORATOR
user: login: rust-log-analyzer
created_at: 2025-03-11T17:54:30Z
body: 
The job **`x86_64-gnu-llvm-18`** failed! Check out the build log: [(web)](https://github.com/rust-lang/rust/actions/runs/13794299452/job/38582041696) [(plain)](https://github.com/rust-lang/rust/commit/473998c21ec6c96d71bc18eb095118f3e375b151/checks/38582041696/logs)

<details><summary><i>Click to see the possible cause of the failure (guessed by this bot)</i></summary>

```plain
#20 exporting to docker image format
#20 sending tarball 20.1s done
#20 DONE 26.5s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
  Number of decisions:   4447
  longest path:          1159 (code:    152)
  longest backtrack:       66 (code:    428)
Shared 86733 out of 152951 states by creating 14756 new states, saving 71977
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc: In function ‘rtx_def* extract_bit_field_1(rtx, poly_uint64, poly_uint64, int, rtx, machine_mode, machine_mode, bool, bool, rtx_def**)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc:1864:45: warning: ‘*(unsigned int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))’ may be used uninitialized [-Wmaybe-uninitialized]
 1864 |       rtx sub = extract_bit_field_as_subreg (mode1, op0, imode,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
 1865 |                                              bitsize, bitnum);
      |                                              ~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc:1824:19: note: ‘*(unsigned int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))’ was declared here
 1824 |   scalar_int_mode imode;
      |                   ^~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-everything’ may have been intended to silence earlier diagnostics
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gimple-range-gori.cc: In member function ‘void range_def_chain::dump(FILE*, basic_block, const char*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gimple-range-gori.cc:319:19: warning: format not a string literal and no format arguments [-Wformat-security]
---
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-everything’ may have been intended to silence earlier diagnostics
In file included from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-playback.h:31,
                 from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/dummy-frontend.cc:25:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h: In member function ‘virtual bool gcc::jit::recording::type::is_same_type_as(gcc::jit::recording::type*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h:640:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
  640 |     if ((is_int () && other->is_int () || is_float() && other->is_float())
      |          ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-everything’ may have been intended to silence earlier diagnostics
In file included from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/libgccjit.cc:30:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h: In member function ‘virtual bool gcc::jit::recording::type::is_same_type_as(gcc::jit::recording::type*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h:640:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
  640 |     if ((is_int () && other->is_int () || is_float() && other->is_float())
      |          ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/libgccjit.cc: In function ‘gcc_jit_type* gcc_jit_context_new_array_type(gcc_jit_context*, gcc_jit_location*, gcc_jit_type*, long unsigned int)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/libgccjit.cc:807:37: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
  807 |   RETURN_NULL_IF_FAIL (num_elements >= 0, ctxt, NULL, "negative size");
---
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-everything’ may have been intended to silence earlier diagnostics
In file included from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-playback.h:31,
                 from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-builtins.cc:24:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h: In member function ‘virtual bool gcc::jit::recording::type::is_same_type_as(gcc::jit::recording::type*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h:640:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
  640 |     if ((is_int () && other->is_int () || is_float() && other->is_float())
      |          ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/omp-builtins.def: At global scope:
./options.h:6899:37: warning: narrowing conversion of ‘global_options.gcc_options::x_flag_openacc’ from ‘int’ to ‘bool’ [-Wnarrowing]
 6899 | #define flag_openacc global_options.x_flag_openacc
      |                      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-builtins.cc:58:23: note: in definition of macro ‘DEF_BUILTIN’
   58 |   {NAME, CLASS, TYPE, BOTH_P, FALLBACK_P, ATTRS, IMPLICIT},
      |                       ^~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/builtins.def:223:16: note: in expansion of macro ‘flag_openacc’
  223 |                flag_openacc, true, true, ATTRS, false, true)
      |                ^~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/omp-builtins.def:55:1: note: in expansion of macro ‘DEF_GOACC_BUILTIN_COMPILER’
   55 | DEF_GOACC_BUILTIN_COMPILER (BUILT_IN_ACC_ON_DEVICE, "acc_on_device",
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
./options.h:6911:36: warning: narrowing conversion of ‘global_options.gcc_options::x_flag_openmp’ from ‘int’ to ‘bool’ [-Wnarrowing]
 6911 | #define flag_openmp global_options.x_flag_openmp
      |                     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-builtins.cc:58:23: note: in definition of macro ‘DEF_BUILTIN’
   58 |   {NAME, CLASS, TYPE, BOTH_P, FALLBACK_P, ATTRS, IMPLICIT},
      |                       ^~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/builtins.def:238:16: note: in expansion of macro ‘flag_openmp’
  238 |                flag_openmp, true, true, ATTRS, false, flag_openmp)
      |                ^~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/omp-builtins.def:72:1: note: in expansion of macro ‘DEF_GOMP_BUILTIN_COMPILER’
   72 | DEF_GOMP_BUILTIN_COMPILER (BUILT_IN_OMP_IS_INITIAL_DEVICE,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: unrecognized command-line option ‘-Wno-everything’ may have been intended to silence earlier diagnostics
In file included from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-playback.h:31,
                 from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-playback.cc:49:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h: In member function ‘virtual bool gcc::jit::recording::type::is_same_type_as(gcc::jit::recording::type*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h:640:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
  640 |     if ((is_int () && other->is_int () || is_float() && other->is_float())
      |          ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-everything’ may have been intended to silence earlier diagnostics
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gengtype-lex.l: In function ‘int yylex(const char**)’:
---
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc:7930:9: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 7930 |   write (fd, "\n\n", 2);
      |   ~~~~~~^~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc: In member function ‘void driver::final_actions() const’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc:9307:13: warning: ignoring return value of ‘int truncate(const char*, __off_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 9307 |     truncate(totruncate_file, 0);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-everything’ may have been intended to silence earlier diagnostics
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto-wrapper.cc: In function ‘bool find_and_merge_options(int, off_t, const char*, vec<cl_decoded_option>, bool, vec<cl_decoded_option>*, const char*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto-wrapper.cc:1165:8: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
---
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc: In function ‘void lto_resolution_read(splay_tree, FILE*, lto_file*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2091:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2091 |   fscanf (resolution, " ");   /* Read white space.  */
      |   ~~~~~~~^~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2093:9: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2093 |   fread (obj_name, sizeof (char), name_len, resolution);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2113:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2113 |   fscanf (resolution, "%u", &num_symbols);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-everything’ may have been intended to silence earlier diagnostics
In file included from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.cc:32:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h: In member function ‘virtual bool gcc::jit::recording::type::is_same_type_as(gcc::jit::recording::type*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.h:640:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
  640 |     if ((is_int () && other->is_int () || is_float() && other->is_float())
      |          ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.cc: In member function ‘virtual void gcc::jit::recording::memento_of_set_personality_function::replay_into(gcc::jit::replayer*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.cc:7595:72: warning: unused parameter ‘r’ [-Wunused-parameter]
 7595 | recording::memento_of_set_personality_function::replay_into (replayer *r)
---
Applying io_quotes_use            to linux/blkzoned.h
Applying io_quotes_use            to linux/ipmi.h
Applying io_quotes_use            to linux/psp-dbc.h
Applying io_quotes_use            to linux/bt-bmc.h
Applying io_quotes_use            to linux/tps6594_pfsm.h
Applying io_quotes_use            to linux/cxl_mem.h
Applying io_quotes_use            to linux/wmi.h
Applying io_quotes_use            to linux/auto_fs.h
Applying io_quotes_use            to linux/mmtimer.h
Applying io_quotes_use            to linux/f2fs.h
Applying io_quotes_use            to linux/vhost.h
---
Applying machine_name             to x86_64-linux-gnu/bits/unistd_ext.h
Applying io_quotes_use            to x86_64-linux-gnu/asm/mtrr.h
Applying io_quotes_use            to x86_64-linux-gnu/asm/amd_hsmp.h
Applying machine_name             to openssl/e_os2.h
Applying io_quotes_use            to drm/xe_drm.h
Applying io_quotes_use            to drm/radeon_drm.h
Applying io_quotes_use            to drm/panfrost_drm.h
Applying io_quotes_use            to drm/etnaviv_drm.h
Applying io_quotes_use            to drm/lima_drm.h
Applying io_quotes_use            to drm/qaic_accel.h
Applying io_quotes_use            to drm/vc4_drm.h
Applying io_quotes_use            to drm/i915_drm.h
Applying io_quotes_use            to drm/omap_drm.h
Applying io_quotes_use            to drm/pvr_drm.h
Applying io_quotes_use            to drm/amdgpu_drm.h
Applying io_quotes_use            to drm/vgem_drm.h
Applying io_quotes_use            to drm/msm_drm.h
Applying io_quotes_use            to drm/v3d_drm.h
Applying io_quotes_use            to drm/exynos_drm.h
Applying io_quotes_use            to drm/nouveau_drm.h
Applying io_quotes_use            to drm/drm.h
Applying io_quotes_use            to drm/habanalabs_accel.h
Applying io_quotes_use            to drm/tegra_drm.h
Applying io_quotes_use            to rdma/rdma_user_ioctl.h
cc1: note: self-tests are not enabled in this build
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/c++tools/server.cc: In function ‘void server(bool, int, module_resolver*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/c++tools/server.cc:620:10: warning: ignoring return value of ‘int pipe(int*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
---
diff of stderr:

2   --> $DIR/abi-mismatch.rs:11:18
3    |
4 LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
-    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention C using calling convention Rust
+    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention "C" using calling convention "Rust"
6    |
7 note: inside `call_rust_fn`
8   --> $DIR/abi-mismatch.rs:7:5


The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/miri_unleashed/abi-mismatch.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/miri_unleashed/abi-mismatch.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/miri_unleashed/abi-mismatch" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "unleash-the-miri-inside-of-you"
stdout: none
--- stderr -------------------------------
error[E0080]: could not evaluate static initializer
##[error]  --> /checkout/tests/ui/consts/miri_unleashed/abi-mismatch.rs:11:18
   |
LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention "C" using calling convention "Rust"
   |
note: inside `call_rust_fn`
  --> /checkout/tests/ui/consts/miri_unleashed/abi-mismatch.rs:7:5
   |
LL |     my_fn(); //~ NOTE inside `call_rust_fn`
   |     ^^^^^^^ the failure occurred here

warning: skipping const checks
   |
help: skipping check that does not even have a feature gate
  --> /checkout/tests/ui/consts/miri_unleashed/abi-mismatch.rs:7:5
   |
LL |     my_fn(); //~ NOTE inside `call_rust_fn`
   |     ^^^^^^^

error: aborting due to 1 previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0080`.
```

</details>
        
author_association: COLLABORATOR
user: login: tiif
created_at: 2025-03-13T01:50:50Z
body: @rustbot ready
author_association: MEMBER
user: login: tiif
created_at: 2025-05-08T01:59:01Z
body: I almost forgot I had this PR open :D

Hi @workingjubilee, just checking if there is anything that still needs to be done on my side.  
author_association: MEMBER
user: login: workingjubilee
created_at: 2025-05-17T04:47:58Z
body: Thanks! Sorry about the delay, meant to approve this before I wound up on the other side of the world!

@bors r+
author_association: MEMBER
user: login: bors
created_at: 2025-05-17T04:48:01Z
body: :pushpin: Commit 41a2260bc7d7388a6ef2b0dfa7a980c977e26081 has been approved by `workingjubilee`

It is now in the [queue](https://bors.rust-lang.org/homu/queue/rust) for this repository.

<!-- @bors r=workingjubilee 41a2260bc7d7388a6ef2b0dfa7a980c977e26081 -->
<!-- homu: {"type":"Approved","sha":"41a2260bc7d7388a6ef2b0dfa7a980c977e26081","approver":"workingjubilee","queue":"https://bors.rust-lang.org/homu/queue/rust"} -->
author_association: COLLABORATOR