@@ -9,7 +9,7 @@ use rustc_borrowck as mir_borrowck;
9
9
use rustc_codegen_ssa:: traits:: CodegenBackend ;
10
10
use rustc_data_structures:: parallel;
11
11
use rustc_data_structures:: sync:: { Lrc , OnceCell , WorkerLocal } ;
12
- use rustc_errors:: { ErrorGuaranteed , PResult } ;
12
+ use rustc_errors:: PResult ;
13
13
use rustc_expand:: base:: { ExtCtxt , LintStoreExpand , ResolverExpand } ;
14
14
use rustc_hir:: def_id:: { StableCrateId , LOCAL_CRATE } ;
15
15
use rustc_lint:: { unerased_lint_store, BufferedEarlyLint , EarlyCheckNode , LintStore } ;
@@ -176,7 +176,7 @@ pub fn configure_and_expand(
176
176
tcx : TyCtxt < ' _ > ,
177
177
mut krate : ast:: Crate ,
178
178
resolver : & mut Resolver < ' _ , ' _ > ,
179
- ) -> Result < ast:: Crate > {
179
+ ) -> ast:: Crate {
180
180
let sess = tcx. sess ;
181
181
let lint_store = unerased_lint_store ( tcx) ;
182
182
let crate_name = tcx. crate_name ( LOCAL_CRATE ) ;
@@ -250,20 +250,19 @@ pub fn configure_and_expand(
250
250
ecx. check_unused_macros ( ) ;
251
251
} ) ;
252
252
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
+ }
254
259
255
260
if cfg ! ( windows) {
256
261
env:: set_var ( "PATH" , & old_path) ;
257
262
}
258
263
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
+ } ) ;
267
266
268
267
sess. time ( "maybe_building_test_harness" , || {
269
268
rustc_builtin_macros:: test_harness:: inject ( sess, resolver, & mut krate)
@@ -366,7 +365,7 @@ pub fn configure_and_expand(
366
365
)
367
366
} ) ;
368
367
369
- Ok ( krate)
368
+ krate
370
369
}
371
370
372
371
// Returns all the paths that correspond to generated files.
0 commit comments