@@ -393,7 +393,11 @@ impl<'tcx> TyCtxt<'tcx> {
393393 /// Additionally, this function will also check if the item is deprecated. If so, and `id` is
394394 /// not `None`, a deprecated lint attached to `id` will be emitted.
395395 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+ } )
397401 }
398402
399403 /// Checks if an item is stable or error out.
@@ -409,6 +413,7 @@ impl<'tcx> TyCtxt<'tcx> {
409413 id : Option < HirId > ,
410414 span : Span ,
411415 inherit_dep : bool ,
416+ unmarked : impl FnOnce ( Span , DefId ) -> ( ) ,
412417 ) {
413418 let soft_handler =
414419 |lint, span, msg : & _ | self . lint_hir ( lint, id. unwrap_or ( hir:: CRATE_HIR_ID ) , span, msg) ;
@@ -417,11 +422,7 @@ impl<'tcx> TyCtxt<'tcx> {
417422 EvalResult :: Deny { feature, reason, issue, is_soft } => {
418423 report_unstable ( self . sess , feature, reason, issue, is_soft, span, soft_handler)
419424 }
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) ,
425426 }
426427 }
427428
0 commit comments