File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,14 +8,24 @@ use std::io::{Read, Write};
88use std:: os:: fd:: AsFd ;
99use std:: rc:: { Rc , Weak } ;
1010pub fn foo_0 ( ) -> i32 {
11+ thread_local ! (
12+ static static_i: Value <i32 > = <Value <i32 >>:: default ( ) ;
13+ ) ;
14+ thread_local ! (
15+ static static_f: Value <f32 > = <Value <f32 >>:: default ( ) ;
16+ ) ;
17+ thread_local ! (
18+ static static_b: Value <bool > = <Value <bool >>:: default ( ) ;
19+ ) ;
1120 thread_local ! (
1221 static kX1: Value <i32 > = Rc :: new( RefCell :: new( 1 ) ) ;
1322 ) ;
1423 thread_local ! (
1524 static kX2: Value <i32 > = Rc :: new( RefCell :: new( 2 ) ) ;
1625 ) ;
1726 ( * kX1. with ( Value :: clone) . borrow_mut ( ) ) += 1 ;
18- return ( ( * kX1. with ( Value :: clone) . borrow ( ) ) + ( * kX2. with ( Value :: clone) . borrow ( ) ) ) ;
27+ return ( ( ( * kX1. with ( Value :: clone) . borrow ( ) ) + ( * kX2. with ( Value :: clone) . borrow ( ) ) )
28+ + ( * static_i. with ( Value :: clone) . borrow ( ) ) ) ;
1929}
2030pub fn main ( ) {
2131 std:: process:: exit ( main_0 ( ) ) ;
Original file line number Diff line number Diff line change @@ -8,10 +8,13 @@ use std::io::{Read, Write};
88use std:: os:: fd:: { AsFd , FromRawFd , IntoRawFd } ;
99use std:: rc:: Rc ;
1010pub unsafe fn foo_0 ( ) -> i32 {
11+ static mut static_i: i32 = 0_i32 ; ;
12+ static mut static_f: f32 = 0.0_f32 ; ;
13+ static mut static_b: bool = false ; ;
1114 static mut kX1: i32 = 1 ; ;
1215 static kX2: i32 = 2 ; ;
1316 kX1 += 1 ;
14- return ( ( kX1) + ( kX2) ) ;
17+ return ( ( ( kX1) + ( kX2) ) + ( static_i ) ) ;
1518}
1619pub fn main ( ) {
1720 unsafe {
Original file line number Diff line number Diff line change 22// Distributed under the MIT license that can be found in the LICENSE file.
33
44int foo () {
5+ static int static_i;
6+ static float static_f;
7+ static bool static_b;
8+
59 static int kX1 = 1 ;
610 static const int kX2 = 2 ;
711 kX1 += 1 ;
8- return kX1 + kX2 ;
12+ return kX1 + kX2 + static_i ;
913}
1014
1115int main () { return foo () + foo () + foo (); }
You can’t perform that action at this time.
0 commit comments