@@ -366,14 +366,19 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
366366 prev_name, cur_name
367367 ) ) ;
368368 }
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+ ) ) ;
370375 }
371376 }
372377
373378 // If we found a panic runtime, then we know by this point that it's the
374379 // only one, but we perform validation here that all the panic strategy
375380 // 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 {
377382 let desired_strategy = sess. panic_strategy ( ) ;
378383
379384 // First up, validate that our selected panic runtime is indeed exactly
@@ -383,7 +388,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
383388 "the linked panic runtime `{}` is \
384389 not compiled with this crate's \
385390 panic strategy `{}`",
386- tcx. crate_name( cnum ) ,
391+ tcx. crate_name( runtime_cnum ) ,
387392 desired_strategy. desc( )
388393 ) ) ;
389394 }
@@ -397,7 +402,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
397402 continue ;
398403 }
399404 let cnum = CrateNum :: new ( i + 1 ) ;
400- if tcx. is_compiler_builtins ( cnum) {
405+ if cnum == runtime_cnum || tcx. is_compiler_builtins ( cnum) {
401406 continue ;
402407 }
403408
0 commit comments