@@ -9,7 +9,7 @@ use rustc_borrowck as mir_borrowck;
99use rustc_codegen_ssa:: traits:: CodegenBackend ;
1010use rustc_data_structures:: parallel;
1111use rustc_data_structures:: sync:: { Lrc , OnceCell , WorkerLocal } ;
12- use rustc_errors:: { ErrorGuaranteed , PResult } ;
12+ use rustc_errors:: PResult ;
1313use rustc_expand:: base:: { ExtCtxt , LintStoreExpand , ResolverExpand } ;
1414use rustc_hir:: def_id:: { StableCrateId , LOCAL_CRATE } ;
1515use rustc_lint:: { unerased_lint_store, BufferedEarlyLint , EarlyCheckNode , LintStore } ;
@@ -176,7 +176,7 @@ pub fn configure_and_expand(
176176 tcx : TyCtxt < ' _ > ,
177177 mut krate : ast:: Crate ,
178178 resolver : & mut Resolver < ' _ , ' _ > ,
179- ) -> Result < ast:: Crate > {
179+ ) -> ast:: Crate {
180180 let sess = tcx. sess ;
181181 let lint_store = unerased_lint_store ( tcx) ;
182182 let crate_name = tcx. crate_name ( LOCAL_CRATE ) ;
@@ -250,20 +250,19 @@ pub fn configure_and_expand(
250250 ecx. check_unused_macros ( ) ;
251251 } ) ;
252252
253- let recursion_limit_hit = ecx. reduced_recursion_limit . is_some ( ) ;
253+ // If we hit a recursion limit, exit early to avoid later passes getting overwhelmed
254+ // with a large AST
255+ if ecx. reduced_recursion_limit . is_some ( ) {
256+ sess. abort_if_errors ( ) ;
257+ unreachable ! ( ) ;
258+ }
254259
255260 if cfg ! ( windows) {
256261 env:: set_var ( "PATH" , & old_path) ;
257262 }
258263
259- if recursion_limit_hit {
260- // If we hit a recursion limit, exit early to avoid later passes getting overwhelmed
261- // with a large AST
262- Err ( ErrorGuaranteed :: unchecked_claim_error_was_emitted ( ) )
263- } else {
264- Ok ( krate)
265- }
266- } ) ?;
264+ krate
265+ } ) ;
267266
268267 sess. time ( "maybe_building_test_harness" , || {
269268 rustc_builtin_macros:: test_harness:: inject ( sess, resolver, & mut krate)
@@ -366,7 +365,7 @@ pub fn configure_and_expand(
366365 )
367366 } ) ;
368367
369- Ok ( krate)
368+ krate
370369}
371370
372371// Returns all the paths that correspond to generated files.
0 commit comments