@@ -366,14 +366,19 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
366
366
prev_name, cur_name
367
367
) ) ;
368
368
}
369
- panic_runtime = Some ( ( cnum, tcx. panic_strategy ( cnum) . unwrap ( ) ) ) ;
369
+ panic_runtime = Some ( (
370
+ cnum,
371
+ tcx. panic_strategy ( cnum) . unwrap_or_else ( || {
372
+ bug ! ( "cannot determine panic strategy of a panic runtime" ) ;
373
+ } ) ,
374
+ ) ) ;
370
375
}
371
376
}
372
377
373
378
// If we found a panic runtime, then we know by this point that it's the
374
379
// only one, but we perform validation here that all the panic strategy
375
380
// compilation modes for the whole DAG are valid.
376
- if let Some ( ( cnum , found_strategy) ) = panic_runtime {
381
+ if let Some ( ( runtime_cnum , found_strategy) ) = panic_runtime {
377
382
let desired_strategy = sess. panic_strategy ( ) ;
378
383
379
384
// First up, validate that our selected panic runtime is indeed exactly
@@ -383,7 +388,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
383
388
"the linked panic runtime `{}` is \
384
389
not compiled with this crate's \
385
390
panic strategy `{}`",
386
- tcx. crate_name( cnum ) ,
391
+ tcx. crate_name( runtime_cnum ) ,
387
392
desired_strategy. desc( )
388
393
) ) ;
389
394
}
@@ -397,7 +402,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
397
402
continue ;
398
403
}
399
404
let cnum = CrateNum :: new ( i + 1 ) ;
400
- if tcx. is_compiler_builtins ( cnum) {
405
+ if cnum == runtime_cnum || tcx. is_compiler_builtins ( cnum) {
401
406
continue ;
402
407
}
403
408
0 commit comments