@@ -185,27 +185,29 @@ pub fn run<F>(run_compiler: F) -> isize
185
185
where F : FnOnce ( ) -> ( CompileResult , Option < Session > ) + Send + ' static
186
186
{
187
187
let result = monitor ( move || {
188
- let ( result, session) = run_compiler ( ) ;
189
- if let Err ( CompileIncomplete :: Errored ( _) ) = result {
190
- match session {
191
- Some ( sess) => {
192
- sess. abort_if_errors ( ) ;
193
- panic ! ( "error reported but abort_if_errors didn't abort???" ) ;
194
- }
195
- None => {
196
- let emitter =
197
- errors:: emitter:: EmitterWriter :: stderr ( errors:: ColorConfig :: Auto ,
198
- None ,
199
- true ,
200
- false ) ;
201
- let handler = errors:: Handler :: with_emitter ( true , false , Box :: new ( emitter) ) ;
202
- handler. emit ( & MultiSpan :: new ( ) ,
203
- "aborting due to previous error(s)" ,
204
- errors:: Level :: Fatal ) ;
205
- panic:: resume_unwind ( Box :: new ( errors:: FatalErrorMarker ) ) ;
188
+ syntax:: with_globals ( || {
189
+ let ( result, session) = run_compiler ( ) ;
190
+ if let Err ( CompileIncomplete :: Errored ( _) ) = result {
191
+ match session {
192
+ Some ( sess) => {
193
+ sess. abort_if_errors ( ) ;
194
+ panic ! ( "error reported but abort_if_errors didn't abort???" ) ;
195
+ }
196
+ None => {
197
+ let emitter =
198
+ errors:: emitter:: EmitterWriter :: stderr ( errors:: ColorConfig :: Auto ,
199
+ None ,
200
+ true ,
201
+ false ) ;
202
+ let handler = errors:: Handler :: with_emitter ( true , false , Box :: new ( emitter) ) ;
203
+ handler. emit ( & MultiSpan :: new ( ) ,
204
+ "aborting due to previous error(s)" ,
205
+ errors:: Level :: Fatal ) ;
206
+ panic:: resume_unwind ( Box :: new ( errors:: FatalErrorMarker ) ) ;
207
+ }
206
208
}
207
209
}
208
- }
210
+ } ) ;
209
211
} ) ;
210
212
211
213
match result {
@@ -471,17 +473,15 @@ pub fn run_compiler<'a>(args: &[String],
471
473
emitter_dest : Option < Box < dyn Write + Send > > )
472
474
-> ( CompileResult , Option < Session > )
473
475
{
474
- syntax:: with_globals ( || {
475
- let matches = match handle_options ( args) {
476
- Some ( matches) => matches,
477
- None => return ( Ok ( ( ) ) , None ) ,
478
- } ;
476
+ let matches = match handle_options ( args) {
477
+ Some ( matches) => matches,
478
+ None => return ( Ok ( ( ) ) , None ) ,
479
+ } ;
479
480
480
- let ( sopts, cfg) = config:: build_session_options_and_crate_config ( & matches) ;
481
+ let ( sopts, cfg) = config:: build_session_options_and_crate_config ( & matches) ;
481
482
482
- driver:: spawn_thread_pool ( sopts, |sopts| {
483
- run_compiler_with_pool ( matches, sopts, cfg, callbacks, file_loader, emitter_dest)
484
- } )
483
+ driver:: spawn_thread_pool ( sopts, |sopts| {
484
+ run_compiler_with_pool ( matches, sopts, cfg, callbacks, file_loader, emitter_dest)
485
485
} )
486
486
}
487
487
0 commit comments