@@ -7,31 +7,51 @@ use std::io::{Read, Seek, Write};
77use std:: os:: fd:: AsFd ;
88use std:: rc:: { Rc , Weak } ;
99pub fn foo_0 ( ) -> i32 {
10- thread_local ! (
11- static static_i_1: Value <i32 > = Rc :: new( RefCell :: new( 0_i32 ) ) ;
12- ) ;
13- thread_local ! (
14- static static_f_2: Value <f32 > = Rc :: new( RefCell :: new( 0_f32 ) ) ;
15- ) ;
16- thread_local ! (
17- static static_b_3: Value <bool > = Rc :: new( RefCell :: new( false ) ) ;
18- ) ;
19- thread_local ! (
20- static kX1_4: Value <i32 > = Rc :: new( RefCell :: new( 1 ) ) ;
21- ) ;
22- thread_local ! (
23- static kX2_5: Value <i32 > = Rc :: new( RefCell :: new( 2 ) ) ;
24- ) ;
2510 kX1_4. with ( |rc| * rc. borrow_mut ( ) += 1 ) ;
2611 return ( ( kX1_4. with ( |rc| * rc. borrow ( ) ) + kX2_5. with ( |rc| * rc. borrow ( ) ) )
2712 + static_i_1. with ( |rc| * rc. borrow ( ) ) ) ;
2813}
14+ thread_local ! (
15+ static static_i_1: Value <i32 > = Rc :: new( RefCell :: new( 0_i32 ) ) ;
16+ ) ;
17+ thread_local ! (
18+ static static_f_2: Value <f32 > = Rc :: new( RefCell :: new( 0_f32 ) ) ;
19+ ) ;
20+ thread_local ! (
21+ static static_b_3: Value <bool > = Rc :: new( RefCell :: new( false ) ) ;
22+ ) ;
23+ thread_local ! (
24+ static kX1_4: Value <i32 > = Rc :: new( RefCell :: new( 1 ) ) ;
25+ ) ;
26+ thread_local ! (
27+ static kX2_5: Value <i32 > = Rc :: new( RefCell :: new( 2 ) ) ;
28+ ) ;
29+ pub fn from_local_class_6 ( ) -> i32 {
30+ return ( ( { S_8Impl :: get ( & Rc :: new ( RefCell :: new ( <S_8 >:: default ( ) ) ) . as_pointer ( ) ) } )
31+ + ( { S_8Impl :: get ( & Rc :: new ( RefCell :: new ( <S_8 >:: default ( ) ) ) . as_pointer ( ) ) } ) ) ;
32+ }
33+ thread_local ! (
34+ static x_7: Value <i32 > = Rc :: new( RefCell :: new( 3 ) ) ;
35+ ) ;
36+ #[ derive( Clone , Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
37+ #[ byte_size( 1 ) ]
38+ pub struct S_8 { }
2939pub fn main ( ) {
3040 __cpp2rust_init_globals ( ) ;
3141 std:: process:: exit ( main_0 ( ) ) ;
3242}
3343fn main_0 ( ) -> i32 {
3444 assert ! ( ( ( ( ( { foo_0( ) } ) + ( { foo_0( ) } ) ) + ( { foo_0( ) } ) ) == 15 ) ) ;
45+ assert ! ( ( ( { from_local_class_6( ) } ) == 9 ) ) ;
46+ assert ! ( ( ( { from_local_class_6( ) } ) == 13 ) ) ;
3547 return 0 ;
3648}
49+ pub trait S_8Impl {
50+ fn get ( & self ) -> i32 ;
51+ }
52+ impl S_8Impl for Ptr < S_8 > {
53+ fn get ( & self ) -> i32 {
54+ return ( * x_7. with ( Value :: clone) . borrow_mut ( ) ) . prefix_inc ( ) ;
55+ }
56+ }
3757pub fn __cpp2rust_init_globals ( ) { }
0 commit comments