@@ -393,7 +393,11 @@ impl<'tcx> TyCtxt<'tcx> {
393
393
/// Additionally, this function will also check if the item is deprecated. If so, and `id` is
394
394
/// not `None`, a deprecated lint attached to `id` will be emitted.
395
395
pub fn check_stability ( self , def_id : DefId , id : Option < HirId > , span : Span ) {
396
- self . check_stability_internal ( def_id, id, span, true )
396
+ self . check_stability_internal ( def_id, id, span, true , |span, def_id| {
397
+ // The API could be uncallable for other reasons, for example when a private module
398
+ // was referenced.
399
+ self . sess . delay_span_bug ( span, & format ! ( "encountered unmarked API: {:?}" , def_id) ) ;
400
+ } )
397
401
}
398
402
399
403
/// Checks if an item is stable or error out.
@@ -409,6 +413,7 @@ impl<'tcx> TyCtxt<'tcx> {
409
413
id : Option < HirId > ,
410
414
span : Span ,
411
415
inherit_dep : bool ,
416
+ unmarked : impl FnOnce ( Span , DefId ) -> ( ) ,
412
417
) {
413
418
let soft_handler =
414
419
|lint, span, msg : & _ | self . lint_hir ( lint, id. unwrap_or ( hir:: CRATE_HIR_ID ) , span, msg) ;
@@ -417,11 +422,7 @@ impl<'tcx> TyCtxt<'tcx> {
417
422
EvalResult :: Deny { feature, reason, issue, is_soft } => {
418
423
report_unstable ( self . sess , feature, reason, issue, is_soft, span, soft_handler)
419
424
}
420
- EvalResult :: Unmarked => {
421
- // The API could be uncallable for other reasons, for example when a private module
422
- // was referenced.
423
- self . sess . delay_span_bug ( span, & format ! ( "encountered unmarked API: {:?}" , def_id) ) ;
424
- }
425
+ EvalResult :: Unmarked => unmarked ( span, def_id) ,
425
426
}
426
427
}
427
428
0 commit comments