@@ -148,13 +148,18 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
148148 let arenas = ty:: CtxtArenas :: new ( ) ;
149149 let hir_map = driver:: make_map ( & sess, & mut hir_forest) ;
150150
151- abort_on_err ( driver:: phase_3_run_analysis_passes ( & sess,
151+ let krate_and_analysis = abort_on_err ( driver:: phase_3_run_analysis_passes ( & sess,
152152 & cstore,
153153 hir_map,
154154 & arenas,
155155 & name,
156156 resolve:: MakeGlobMap :: No ,
157- |tcx, _, analysis, _| {
157+ |tcx, _, analysis, result| {
158+ // Return if the driver hit an err (in `result`)
159+ if let Err ( _) = result {
160+ return None
161+ }
162+
158163 let _ignore = tcx. dep_graph . in_ignore ( ) ;
159164 let ty:: CrateAnalysis { access_levels, .. } = analysis;
160165
@@ -195,11 +200,17 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
195200
196201 let external_paths = ctxt. external_paths . borrow_mut ( ) . take ( ) ;
197202 * analysis. external_paths . borrow_mut ( ) = external_paths;
203+
198204 let map = ctxt. external_typarams . borrow_mut ( ) . take ( ) ;
199205 * analysis. external_typarams . borrow_mut ( ) = map;
206+
200207 let map = ctxt. inlined . borrow_mut ( ) . take ( ) ;
201208 * analysis. inlined . borrow_mut ( ) = map;
209+
202210 analysis. deref_trait_did = ctxt. deref_trait_did . get ( ) ;
203- ( krate, analysis)
204- } ) , & sess)
211+
212+ Some ( ( krate, analysis) )
213+ } ) , & sess) ;
214+
215+ krate_and_analysis. unwrap ( )
205216}
0 commit comments