@@ -28,7 +28,7 @@ pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count};
28
28
29
29
// To reduce the generated code of the new `lang_start`, this function is doing
30
30
// the real work.
31
- #[ cfg( not( any ( test, stage0 ) ) ) ]
31
+ #[ cfg( not( test) ) ]
32
32
fn lang_start_internal ( main : & ( Fn ( ) -> i32 + Sync + :: panic:: RefUnwindSafe ) ,
33
33
argc : isize , argv : * const * const u8 ) -> isize {
34
34
use panic;
@@ -66,55 +66,10 @@ fn lang_start_internal(main: &(Fn() -> i32 + Sync + ::panic::RefUnwindSafe),
66
66
}
67
67
}
68
68
69
- #[ cfg( not( any ( test, stage0 ) ) ) ]
69
+ #[ cfg( not( test) ) ]
70
70
#[ lang = "start" ]
71
71
fn lang_start < T : :: termination:: Termination + ' static >
72
72
( main : fn ( ) -> T , argc : isize , argv : * const * const u8 ) -> isize
73
73
{
74
74
lang_start_internal ( & move || main ( ) . report ( ) , argc, argv)
75
75
}
76
-
77
- #[ cfg( all( not( test) , stage0) ) ]
78
- #[ lang = "start" ]
79
- fn lang_start ( main : fn ( ) , argc : isize , argv : * const * const u8 ) -> isize {
80
- use panic;
81
- use sys;
82
- use sys_common;
83
- use sys_common:: thread_info;
84
- use thread:: Thread ;
85
- #[ cfg( not( feature = "backtrace" ) ) ]
86
- use mem;
87
-
88
- sys:: init ( ) ;
89
-
90
- let failed = unsafe {
91
- let main_guard = sys:: thread:: guard:: init ( ) ;
92
- sys:: stack_overflow:: init ( ) ;
93
-
94
- // Next, set up the current Thread with the guard information we just
95
- // created. Note that this isn't necessary in general for new threads,
96
- // but we just do this to name the main thread and to give it correct
97
- // info about the stack bounds.
98
- let thread = Thread :: new ( Some ( "main" . to_owned ( ) ) ) ;
99
- thread_info:: set ( main_guard, thread) ;
100
-
101
- // Store our args if necessary in a squirreled away location
102
- sys:: args:: init ( argc, argv) ;
103
-
104
- // Let's run some code!
105
- #[ cfg( feature = "backtrace" ) ]
106
- let res = panic:: catch_unwind ( || {
107
- :: sys_common:: backtrace:: __rust_begin_short_backtrace ( main)
108
- } ) ;
109
- #[ cfg( not( feature = "backtrace" ) ) ]
110
- let res = panic:: catch_unwind ( mem:: transmute :: < _ , fn ( ) > ( main) ) ;
111
- sys_common:: cleanup ( ) ;
112
- res. is_err ( )
113
- } ;
114
-
115
- if failed {
116
- 101
117
- } else {
118
- 0
119
- }
120
- }
0 commit comments