@@ -83,12 +83,24 @@ fn main() {
83
83
test_abi_compat ( main as fn ( ) , id :: < i32 > as fn ( i32 ) -> i32 ) ;
84
84
// - 1-ZST
85
85
test_abi_compat ( ( ) , [ 0u8 ; 0 ] ) ;
86
- // - Guaranteed null-pointer-optimizations (RFC 3391).
86
+ // - Guaranteed Option<X> null-pointer-optimizations (RFC 3391).
87
87
test_abi_compat ( & 0u32 as * const u32 , Some ( & 0u32 ) ) ;
88
88
test_abi_compat ( main as fn ( ) , Some ( main as fn ( ) ) ) ;
89
89
test_abi_compat ( 0u32 , Some ( num:: NonZero :: new ( 1u32 ) . unwrap ( ) ) ) ;
90
90
test_abi_compat ( & 0u32 as * const u32 , Some ( Wrapper ( & 0u32 ) ) ) ;
91
- test_abi_compat ( 0u32 , Some ( Wrapper ( num:: NonZero :: new ( 1u32 ) . unwrap ( ) ) ) ) ;
91
+ test_abi_compat ( 0u32 , Some ( Wrapper ( num:: NonZeroU32 :: new ( 1u32 ) . unwrap ( ) ) ) ) ;
92
+ // - Guaranteed Result<X, ZST1> does the same as Option<X> (RFC 3391)
93
+ test_abi_compat ( & 0u32 as * const u32 , Result :: < _ , ( ) > :: Ok ( & 0u32 ) ) ;
94
+ test_abi_compat ( main as fn ( ) , Result :: < _ , ( ) > :: Ok ( main as fn ( ) ) ) ;
95
+ test_abi_compat ( 0u32 , Result :: < _ , ( ) > :: Ok ( num:: NonZeroU32 :: new ( 1 ) . unwrap ( ) ) ) ;
96
+ test_abi_compat ( & 0u32 as * const u32 , Result :: < _ , ( ) > :: Ok ( Wrapper ( & 0u32 ) ) ) ;
97
+ test_abi_compat ( 0u32 , Result :: < _ , ( ) > :: Ok ( Wrapper ( num:: NonZeroU32 :: new ( 1 ) . unwrap ( ) ) ) ) ;
98
+ // - Guaranteed Result<ZST1, X> also does the same as Option<X> (RFC 3391)
99
+ test_abi_compat ( & 0u32 as * const u32 , Result :: < ( ) , _ > :: Err ( & 0u32 ) ) ;
100
+ test_abi_compat ( main as fn ( ) , Result :: < ( ) , _ > :: Err ( main as fn ( ) ) ) ;
101
+ test_abi_compat ( 0u32 , Result :: < ( ) , _ > :: Err ( num:: NonZeroU32 :: new ( 1 ) . unwrap ( ) ) ) ;
102
+ test_abi_compat ( & 0u32 as * const u32 , Result :: < ( ) , _ > :: Err ( Wrapper ( & 0u32 ) ) ) ;
103
+ test_abi_compat ( 0u32 , Result :: < ( ) , _ > :: Err ( Wrapper ( num:: NonZeroU32 :: new ( 1 ) . unwrap ( ) ) ) ) ;
92
104
93
105
// These must work for *any* type, since we guarantee that `repr(transparent)` is ABI-compatible
94
106
// with the wrapped field.
0 commit comments