File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
c2rust-transpile/tests/snapshots Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,14 @@ void entry(void) {
2525 char char_too_long [3 ] = "abcde" ;
2626 char char_too_short [20 ] = "abc" ;
2727
28- char * char_ptr = "abc" ;
28+ int * int_var_ptr = int_empty_init ;
29+ int (* int_var_array_ptr )[16 ] = & int_empty_init ;
30+ char * char_var_ptr_var = char_with_string ;
31+ char (* char_var_array_ptr )[4 ] = & char_with_string ;
32+ const char * const_char_lit_ptr = "abc" ;
33+ const char (* const_char_lit_array_ptr )[4 ] = & "abc" ;
34+ char * char_lit_ptr = "abc" ;
35+ char (* char_lit_array_ptr )[4 ] = & "abc" ;
2936
3037// TODO re-enable after #1266 adds portable support for translating `wchar_t`.
3138#if 0
Original file line number Diff line number Diff line change @@ -79,8 +79,20 @@ pub unsafe extern "C" fn entry() {
7979 ::core ::mem ::transmute ::< [u8 ; 20 ], [::core ::ffi ::c_char ; 20 ]> (
8080 * b " abc\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 " ,
8181 );
82- let mut char_ptr: *mut ::core ::ffi ::c_char =
82+ let mut int_var_ptr: *mut ::core ::ffi ::c_int = int_empty_init .as_mut_ptr ();
83+ let mut int_var_array_ptr: *mut [::core ::ffi ::c_int ; 16 ] = & mut int_empty_init ;
84+ let mut char_var_ptr_var: *mut ::core ::ffi ::c_char = char_with_string .as_mut_ptr ();
85+ let mut char_var_array_ptr: *mut [::core ::ffi ::c_char ; 4 ] = & mut char_with_string ;
86+ let mut const_char_lit_ptr: *const ::core ::ffi ::c_char =
87+ b " abc\0 " as *const u8 as *const ::core ::ffi ::c_char ;
88+ let mut const_char_lit_array_ptr: *const [::core ::ffi ::c_char ; 4 ] =
89+ & ::core ::mem ::transmute ::< [u8 ; 4 ], [::core ::ffi ::c_char ; 4 ]> (* b " abc\0 " )
90+ as *const [::core ::ffi ::c_char ; 4 ];
91+ let mut char_lit_ptr: *mut ::core ::ffi ::c_char =
8392 b " abc\0 " as *const u8 as *const ::core ::ffi ::c_char as *mut ::core ::ffi ::c_char ;
93+ let mut char_lit_array_ptr: *mut [::core ::ffi ::c_char ; 4 ] =
94+ & ::core ::mem ::transmute ::< [u8 ; 4 ], [::core ::ffi ::c_char ; 4 ]> (* b " abc\0 " )
95+ as *const [::core ::ffi ::c_char ; 4 ] as *mut [::core ::ffi ::c_char ; 4 ];
8496 let mut past_end: *mut ::core ::ffi ::c_char = & mut * simple
8597 .as_mut_ptr ()
8698 .offset (::core ::mem ::size_of ::< [::core ::ffi ::c_char ; 9 ]> () as isize )
You can’t perform that action at this time.
0 commit comments