@@ -14,7 +14,7 @@ use rustc_hir::def::{DefKind, Namespace, PerNS};
1414use rustc_hir:: def_id:: { DefId , CRATE_DEF_ID } ;
1515use rustc_hir:: Mutability ;
1616use rustc_middle:: ty:: { Ty , TyCtxt } ;
17- use rustc_middle:: { bug, ty} ;
17+ use rustc_middle:: { bug, span_bug , ty} ;
1818use rustc_resolve:: rustdoc:: { has_primitive_or_keyword_docs, prepare_to_doc_link_resolution} ;
1919use rustc_resolve:: rustdoc:: { strip_generics_from_path, MalformedGenerics } ;
2020use rustc_session:: lint:: Lint ;
@@ -402,7 +402,12 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
402402 // `doc_link_resolutions` is missing a `path_str`, that means that there are valid links
403403 // that are being missed. To fix the ICE, change
404404 // `rustc_resolve::rustdoc::attrs_to_preprocessed_links` to cache the link.
405- . unwrap_or_else ( || panic ! ( "no resolution for {:?} {:?} {:?}" , path_str, ns, module_id) )
405+ . unwrap_or_else ( || {
406+ span_bug ! (
407+ self . cx. tcx. def_span( item_id) ,
408+ "no resolution for {path_str:?} {ns:?} {module_id:?}" ,
409+ )
410+ } )
406411 . and_then ( |res| res. try_into ( ) . ok ( ) )
407412 . or_else ( || resolve_primitive ( path_str, ns) ) ;
408413 debug ! ( "{} resolved to {:?} in namespace {:?}" , path_str, result, ns) ;
@@ -963,6 +968,7 @@ fn preprocessed_markdown_links(s: &str) -> Vec<PreprocessedMarkdownLink> {
963968}
964969
965970impl LinkCollector < ' _ , ' _ > {
971+ #[ instrument( level = "debug" , skip_all) ]
966972 fn resolve_links ( & mut self , item : & Item ) {
967973 if !self . cx . render_options . document_private
968974 && let Some ( def_id) = item. item_id . as_def_id ( )
0 commit comments