File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 6
6
stack backtrace:
7
7
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
8
8
panic in a destructor during cleanup
9
- stack backtrace:
10
9
thread caused non-unwinding panic. aborting.
11
10
error: abnormal termination: the program aborted execution
12
11
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
@@ -19,7 +18,7 @@ LL | ABORT();
19
18
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
20
19
= 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
21
20
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
22
- = note: inside `core::panicking::panic_nounwind ` at RUSTLIB/core/src/panicking.rs:LL:CC
21
+ = note: inside `core::panicking::panic_nounwind_nobacktrace ` at RUSTLIB/core/src/panicking.rs:LL:CC
23
22
= note: inside `core::panicking::panic_in_cleanup` at RUSTLIB/core/src/panicking.rs:LL:CC
24
23
note: inside `main`
25
24
--> $DIR/double_panic.rs:LL:CC
Original file line number Diff line number Diff line change
1
+ use std:: num;
2
+ use std:: mem;
3
+
4
+ fn test_abi_compat < T , U > ( t : T , u : U ) {
5
+ fn id < T > ( x : T ) -> T { x }
6
+
7
+ // This checks ABI compatibility both for arguments and return values,
8
+ // in both directions.
9
+ let f: fn ( T ) -> T = id;
10
+ let f: fn ( U ) -> U = unsafe { std:: mem:: transmute ( f) } ;
11
+ drop ( f ( u) ) ;
12
+
13
+ let f: fn ( U ) -> U = id;
14
+ let f: fn ( T ) -> T = unsafe { std:: mem:: transmute ( f) } ;
15
+ drop ( f ( t) ) ;
16
+ }
17
+
18
+ fn main ( ) {
19
+ test_abi_compat ( 0u32 , 'x' ) ;
20
+ test_abi_compat ( & 0u32 , & ( [ true ; 4 ] , [ 0u32 ; 0 ] ) ) ;
21
+ test_abi_compat ( 0u32 , mem:: MaybeUninit :: new ( 0u32 ) ) ;
22
+ test_abi_compat ( 42u32 , num:: NonZeroU32 :: new ( 1 ) . unwrap ( ) ) ;
23
+ test_abi_compat ( 0u32 , Some ( num:: NonZeroU32 :: new ( 1 ) . unwrap ( ) ) ) ;
24
+ test_abi_compat ( 0u32 , 0i32 ) ;
25
+ // Note that `bool` and `u8` are *not* compatible!
26
+ // One of them has `arg_ext: Zext`, the other does not.
27
+ }
You can’t perform that action at this time.
0 commit comments