about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorThe Miri Conjob Bot <miri@cron.bot>2023-08-29 05:43:09 +0000
committerThe Miri Conjob Bot <miri@cron.bot>2023-08-29 05:43:09 +0000
commit650294cdc240de273af88d4165e7a47b5357811e (patch)
treedd01bdce3994dd6fcbff03e39a13e2294541cb39 /src/tools
parentca7acd48e6f9878b023d1d3b39e46c04bef14a7e (diff)
parentf3284dc3ad9254236d296daa1285dd273b492b01 (diff)
downloadrust-650294cdc240de273af88d4165e7a47b5357811e.tar.gz
rust-650294cdc240de273af88d4165e7a47b5357811e.zip
Merge from rustc
Diffstat (limited to 'src/tools')
m---------src/tools/cargo0
-rw-r--r--src/tools/miri/tests/fail/panic/double_panic.stderr3
-rw-r--r--src/tools/miri/tests/pass/function_calls/abi_compat.rs27
-rw-r--r--src/tools/tidy/src/error_codes.rs7
4 files changed, 34 insertions, 3 deletions
diff --git a/src/tools/cargo b/src/tools/cargo
-Subproject 2cc50bc0b63ad20da193e002ba11d391af0104b
+Subproject 925280f028db3a322935e040719a0754703947c
diff --git a/src/tools/miri/tests/fail/panic/double_panic.stderr b/src/tools/miri/tests/fail/panic/double_panic.stderr
index 9efba031250..a39522c8a61 100644
--- a/src/tools/miri/tests/fail/panic/double_panic.stderr
+++ b/src/tools/miri/tests/fail/panic/double_panic.stderr
@@ -6,7 +6,6 @@ second
 stack backtrace:
 thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
 panic in a destructor during cleanup
-stack backtrace:
 thread caused non-unwinding panic. aborting.
 error: abnormal termination: the program aborted execution
   --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
@@ -19,7 +18,7 @@ LL |     ABORT();
    = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
    = note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
    = note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
-   = note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
+   = note: inside `core::panicking::panic_nounwind_nobacktrace` at RUSTLIB/core/src/panicking.rs:LL:CC
    = note: inside `core::panicking::panic_in_cleanup` at RUSTLIB/core/src/panicking.rs:LL:CC
 note: inside `main`
   --> $DIR/double_panic.rs:LL:CC
diff --git a/src/tools/miri/tests/pass/function_calls/abi_compat.rs b/src/tools/miri/tests/pass/function_calls/abi_compat.rs
new file mode 100644
index 00000000000..67b87b46bd9
--- /dev/null
+++ b/src/tools/miri/tests/pass/function_calls/abi_compat.rs
@@ -0,0 +1,27 @@
+use std::num;
+use std::mem;
+
+fn test_abi_compat<T, U>(t: T, u: U) {
+    fn id<T>(x: T) -> T { x }
+    
+    // This checks ABI compatibility both for arguments and return values,
+    // in both directions.
+    let f: fn(T) -> T = id;
+    let f: fn(U) -> U = unsafe { std::mem::transmute(f) };
+    drop(f(u));
+    
+    let f: fn(U) -> U = id;
+    let f: fn(T) -> T = unsafe { std::mem::transmute(f) };
+    drop(f(t));
+}
+
+fn main() {
+    test_abi_compat(0u32, 'x');
+    test_abi_compat(&0u32, &([true; 4], [0u32; 0]));
+    test_abi_compat(0u32, mem::MaybeUninit::new(0u32));
+    test_abi_compat(42u32, num::NonZeroU32::new(1).unwrap());
+    test_abi_compat(0u32, Some(num::NonZeroU32::new(1).unwrap()));
+    test_abi_compat(0u32, 0i32);
+    // Note that `bool` and `u8` are *not* compatible!
+    // One of them has `arg_ext: Zext`, the other does not.
+}
diff --git a/src/tools/tidy/src/error_codes.rs b/src/tools/tidy/src/error_codes.rs
index 417ace58c32..3e67bac499b 100644
--- a/src/tools/tidy/src/error_codes.rs
+++ b/src/tools/tidy/src/error_codes.rs
@@ -354,7 +354,12 @@ fn check_error_codes_used(
 
     for code in error_codes {
         if !found_codes.contains(code) && !no_longer_emitted.contains(code) {
-            errors.push(format!("Error code `{code}` exists, but is not emitted by the compiler!"))
+            errors.push(format!(
+                "Error code `{code}` exists, but is not emitted by the compiler!\n\
+                Please mark the code as no longer emitted by adding the following note to the top of the `EXXXX.md` file:\n\
+                `#### Note: this error code is no longer emitted by the compiler`\n\
+                Also, do not forget to mark doctests that no longer apply as `ignore (error is no longer emitted)`."
+            ));
         }
 
         if found_codes.contains(code) && no_longer_emitted.contains(code) {