@@ -219,7 +219,11 @@ fn postprocess<T: Serialize>(result: FlowistryResult<T>) -> RustcResult<()> {
219
219
let result = match result {
220
220
Ok ( output) => Ok ( output) ,
221
221
Err ( e) => match e {
222
- FlowistryError :: BuildError ( e) => return Err ( e) ,
222
+ FlowistryError :: BuildError =>
223
+ {
224
+ #[ allow( deprecated) ]
225
+ return Err ( ErrorGuaranteed :: unchecked_error_guaranteed ( ) )
226
+ }
223
227
e => Err ( e) ,
224
228
} ,
225
229
} ;
@@ -248,7 +252,11 @@ pub fn run_with_callbacks(
248
252
) ;
249
253
250
254
let compiler = rustc_driver:: RunCompiler :: new ( & args, callbacks) ;
251
- compiler. run ( ) . map_err ( FlowistryError :: BuildError )
255
+
256
+ rustc_driver:: catch_fatal_errors ( move || {
257
+ compiler. run ( ) ;
258
+ } )
259
+ . map_err ( |_| FlowistryError :: BuildError )
252
260
}
253
261
254
262
fn run < A : FlowistryAnalysis , T : ToSpan > (
@@ -280,7 +288,7 @@ fn run<A: FlowistryAnalysis, T: ToSpan>(
280
288
#[ derive( Debug , Serialize ) ]
281
289
#[ serde( tag = "type" ) ]
282
290
pub enum FlowistryError {
283
- BuildError ( # [ serde ( skip_serializing ) ] ErrorGuaranteed ) ,
291
+ BuildError ,
284
292
AnalysisError { error : String } ,
285
293
FileNotFound ,
286
294
}
@@ -321,26 +329,22 @@ impl<A: FlowistryAnalysis, T: ToSpan, F: FnOnce() -> T> rustc_driver::Callbacks
321
329
config. override_queries = Some ( borrowck_facts:: override_queries) ;
322
330
}
323
331
324
- fn after_expansion < ' tcx > (
332
+ fn after_analysis < ' tcx > (
325
333
& mut self ,
326
334
_compiler : & rustc_interface:: interface:: Compiler ,
327
- queries : & ' tcx rustc_interface :: Queries < ' tcx > ,
335
+ tcx : TyCtxt < ' tcx > ,
328
336
) -> rustc_driver:: Compilation {
329
337
elapsed ( "rustc" , self . rustc_start ) ;
330
338
fluid_set ! ( EVAL_MODE , self . eval_mode. unwrap_or_default( ) ) ;
331
339
332
- let start = Instant :: now ( ) ;
333
- queries. global_ctxt ( ) . unwrap ( ) . enter ( |tcx| {
334
- elapsed ( "global_ctxt" , start) ;
335
- let mut analysis = self . analysis . take ( ) . unwrap ( ) ;
336
- self . output = Some ( ( || {
337
- let target = ( self . compute_target . take ( ) . unwrap ( ) ) ( ) . to_span ( tcx) ?;
338
- debug ! ( "target span: {target:?}" ) ;
339
- let mut bodies = find_enclosing_bodies ( tcx, target) ;
340
- let body = bodies. next ( ) . context ( "Selection did not map to a body" ) ?;
341
- analysis. analyze ( tcx, body)
342
- } ) ( ) ) ;
343
- } ) ;
340
+ let mut analysis = self . analysis . take ( ) . unwrap ( ) ;
341
+ self . output = Some ( ( || {
342
+ let target = ( self . compute_target . take ( ) . unwrap ( ) ) ( ) . to_span ( tcx) ?;
343
+ debug ! ( "target span: {target:?}" ) ;
344
+ let mut bodies = find_enclosing_bodies ( tcx, target) ;
345
+ let body = bodies. next ( ) . context ( "Selection did not map to a body" ) ?;
346
+ analysis. analyze ( tcx, body)
347
+ } ) ( ) ) ;
344
348
345
349
rustc_driver:: Compilation :: Stop
346
350
}
0 commit comments