File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ unsafe fn main_0() -> i32 {
4646 let mut p: * mut i32 = ( & mut storage as * mut i32 ) ;
4747 let mut np: * mut i32 = std:: ptr:: null_mut ( ) ;
4848 let mut u: u32 = 4_u32 ;
49- let mut code: Code = Code :: from ( ( Code :: CODE_OK as i32 ) ) ;
49+ let mut code: Code = Code :: CODE_OK ;
5050 if ( ( ( ( n != 0 ) && ( !( p) . is_null ( ) ) ) as i32 ) != 0 ) {
5151 assert ! ( ( 1 != 0 ) ) ;
5252 }
Original file line number Diff line number Diff line change @@ -82,15 +82,15 @@ unsafe fn main_0() -> i32 {
8282 assert ! ( ( ( ( ( ( * b. next) . value) == ( 1 ) ) as i32 ) != 0 ) ) ;
8383 let mut c: Container = Container {
8484 inner : Inner { a : 5 , b : 6 } ,
85- color : Color :: from ( ( Color :: GREEN as i32 ) ) ,
85+ color : Color :: GREEN ,
8686 count : 42 ,
8787 } ;
8888 assert ! ( ( ( ( ( c. inner. a) == ( 5 ) ) as i32 ) != 0 ) ) ;
8989 assert ! ( ( ( ( ( c. inner. b) == ( 6 ) ) as i32 ) != 0 ) ) ;
9090 assert ! ( ( ( ( ( c. color as u32 ) == ( ( Color :: GREEN as i32 ) as u32 ) ) as i32 ) != 0 ) ) ;
9191 assert ! ( ( ( ( ( c. count) == ( 42 ) ) as i32 ) != 0 ) ) ;
9292 let mut c2: Container = <Container >:: default ( ) ;
93- c2. color = Color :: from ( ( Color :: BLUE as i32 ) ) ;
93+ c2. color = Color :: BLUE ;
9494 assert ! ( ( ( ( ( c2. color as u32 ) == ( 2_u32 ) ) as i32 ) != 0 ) ) ;
9595 return 0 ;
9696}
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ pub struct Entry {
6666 pub color : Color ,
6767 pub opt : Option ,
6868}
69+ // SAFETY: preserves unsafe C semantics; thread-safety is not enforced
70+ unsafe impl Sync for Entry { }
6971pub static mut global_color: Color = Color :: GREEN ;
7072pub static mut global_opt: Option = Option :: OPT_B ;
7173pub static mut global_tag: Tag = Tag :: TAG_TWO ;
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ pub struct Entry {
6666 pub color : Color ,
6767 pub opt : Option ,
6868}
69+ // SAFETY: preserves unsafe C semantics; thread-safety is not enforced
70+ unsafe impl Sync for Entry { }
6971pub static mut global_color: Color = Color :: GREEN ;
7072pub static mut global_opt: Option = Option :: OPT_B ;
7173pub static mut global_tag: Tag = Tag :: TAG_TWO ;
Original file line number Diff line number Diff line change @@ -56,24 +56,24 @@ pub fn main() {
5656}
5757unsafe fn main_0 ( ) -> i32 {
5858 let mut a: Slot = <Slot >:: default ( ) ;
59- a. tag = Tag :: from ( ( Tag :: T_NUM_S as i32 ) ) ;
59+ a. tag = Tag :: T_NUM_S ;
6060 a. payload . signed_n = ( -7_i32 as i64 ) ;
6161 assert ! ( ( ( ( ( a. payload. signed_n) == ( -7_i32 as i64 ) ) as i32 ) != 0 ) ) ;
6262 let mut b: Slot = <Slot >:: default ( ) ;
63- b. tag = Tag :: from ( ( Tag :: T_NUM_U as i32 ) ) ;
63+ b. tag = Tag :: T_NUM_U ;
6464 b. payload . unsigned_n = 3735928559_u64 ;
6565 assert ! ( ( ( ( ( b. payload. unsigned_n) == ( 3735928559_u64 ) ) as i32 ) != 0 ) ) ;
6666 let mut c: Slot = <Slot >:: default ( ) ;
67- c. tag = Tag :: from ( ( Tag :: T_TEXT as i32 ) ) ;
67+ c. tag = Tag :: T_TEXT ;
6868 c. payload . text = b"hello\0 " . as_ptr ( ) . cast_mut ( ) . cast_const ( ) ;
6969 assert ! ( ( ( ( ( ( * c. payload. text. offset( ( 0 ) as isize ) ) as i32 ) == ( 'h' as i32 ) ) as i32 ) != 0 ) ) ;
7070 let mut d: Slot = <Slot >:: default ( ) ;
71- d. tag = Tag :: from ( ( Tag :: T_FLOAT as i32 ) ) ;
71+ d. tag = Tag :: T_FLOAT ;
7272 d. payload . f = 1.5E+0 ;
7373 assert ! ( ( ( ( ( d. payload. f) == ( 1.5E+0 ) ) as i32 ) != 0 ) ) ;
7474 let mut x: i32 = 0 ;
7575 let mut e: Slot = <Slot >:: default ( ) ;
76- e. tag = Tag :: from ( ( Tag :: T_REF as i32 ) ) ;
76+ e. tag = Tag :: T_REF ;
7777 e. payload . handle = ( ( & mut x as * mut i32 ) as * mut i32 as * mut :: libc:: c_void ) ;
7878 assert ! (
7979 ( ( ( ( e. payload. handle) == ( ( & mut x as * mut i32 ) as * mut i32 as * mut :: libc:: c_void) )
Original file line number Diff line number Diff line change @@ -51,13 +51,13 @@ pub fn main() {
5151unsafe fn main_0 ( ) -> i32 {
5252 let mut dummy: i32 = 0 ;
5353 let mut m1: Event = <Event >:: default ( ) ;
54- m1. kind = Kind :: from ( ( Kind :: KIND_DONE as i32 ) ) ;
54+ m1. kind = Kind :: KIND_DONE ;
5555 m1. handle = ( ( & mut dummy as * mut i32 ) as * mut i32 as * mut :: libc:: c_void ) ;
5656 m1. payload . code = 42 ;
5757 assert ! ( ( ( ( ( m1. kind as u32 ) == ( ( Kind :: KIND_DONE as i32 ) as u32 ) ) as i32 ) != 0 ) ) ;
5858 assert ! ( ( ( ( ( m1. payload. code) == ( 42 ) ) as i32 ) != 0 ) ) ;
5959 let mut m2: Event = <Event >:: default ( ) ;
60- m2. kind = Kind :: from ( ( Kind :: KIND_NONE as i32 ) ) ;
60+ m2. kind = Kind :: KIND_NONE ;
6161 m2. handle = ( ( & mut dummy as * mut i32 ) as * mut i32 as * mut :: libc:: c_void ) ;
6262 m2. payload . obj = ( ( & mut dummy as * mut i32 ) as * mut i32 as * mut :: libc:: c_void ) ;
6363 assert ! (
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ unsafe fn main_0() -> i32 {
8080 b"c\0 " . as_ptr ( ) . cast_mut ( ) ,
8181 ] ; ;
8282 let mut p_list: Branch = <Branch >:: default ( ) ;
83- p_list. choice = Choice :: from ( ( Choice :: C_LIST as i32 ) ) ;
83+ p_list. choice = Choice :: C_LIST ;
8484 p_list. index = 0 ;
8585 p_list. v . list . items = items. as_mut_ptr ( ) ;
8686 p_list. v . list . count = 3_i64 ;
@@ -92,15 +92,15 @@ unsafe fn main_0() -> i32 {
9292 != 0 )
9393 ) ;
9494 let mut p_letters: Branch = <Branch >:: default ( ) ;
95- p_letters. choice = Choice :: from ( ( Choice :: C_LETTERS as i32 ) ) ;
95+ p_letters. choice = Choice :: C_LETTERS ;
9696 p_letters. index = 1 ;
9797 p_letters. v . letters . lo = ( 'a' as i32 ) ;
9898 p_letters. v . letters . hi = ( 'z' as i32 ) ;
9999 p_letters. v . letters . curr = ( 'm' as i32 ) ;
100100 p_letters. v . letters . step = 1_u8 ;
101101 assert ! ( ( ( ( ( ( p_letters. v. letters. hi) - ( p_letters. v. letters. lo) ) == ( 25 ) ) as i32 ) != 0 ) ) ;
102102 let mut p_integers: Branch = <Branch >:: default ( ) ;
103- p_integers. choice = Choice :: from ( ( Choice :: C_INTEGERS as i32 ) ) ;
103+ p_integers. choice = Choice :: C_INTEGERS ;
104104 p_integers. index = 2 ;
105105 p_integers. v . integers . lo = 1_i64 ;
106106 p_integers. v . integers . hi = 100_i64 ;
Original file line number Diff line number Diff line change @@ -74,23 +74,23 @@ unsafe fn main_0() -> i32 {
7474 let mut buf32: i32 = 0 ;
7575 let mut buf16: i16 = 0_i16 ;
7676 let mut s: Sink = <Sink >:: default ( ) ;
77- s. width = Width :: from ( ( Width :: W_64 as i32 ) ) ;
77+ s. width = Width :: W_64 ;
7878 s. out . handle = ( ( & mut buf64 as * mut i64 ) as * mut i64 as * mut :: libc:: c_void ) ;
7979 ( unsafe {
8080 let _s: * mut Sink = ( & mut s as * mut Sink ) ;
8181 let _count: i64 = 1234605616436508552_i64 ;
8282 write_count_0 ( _s, _count)
8383 } ) ;
8484 assert ! ( ( ( ( ( buf64) == ( 1234605616436508552_i64 ) ) as i32 ) != 0 ) ) ;
85- s. width = Width :: from ( ( Width :: W_32 as i32 ) ) ;
85+ s. width = Width :: W_32 ;
8686 s. out . handle = ( ( & mut buf32 as * mut i32 ) as * mut i32 as * mut :: libc:: c_void ) ;
8787 ( unsafe {
8888 let _s: * mut Sink = ( & mut s as * mut Sink ) ;
8989 let _count: i64 = 305419896_i64 ;
9090 write_count_0 ( _s, _count)
9191 } ) ;
9292 assert ! ( ( ( ( ( buf32) == ( 305419896 ) ) as i32 ) != 0 ) ) ;
93- s. width = Width :: from ( ( Width :: W_16 as i32 ) ) ;
93+ s. width = Width :: W_16 ;
9494 s. out . handle = ( ( & mut buf16 as * mut i16 ) as * mut i16 as * mut :: libc:: c_void ) ;
9595 ( unsafe {
9696 let _s: * mut Sink = ( & mut s as * mut Sink ) ;
You can’t perform that action at this time.
0 commit comments