@@ -1295,7 +1295,8 @@ impl LinkCollector<'_, '_> {
12951295 }
12961296 }
12971297 }
1298- resolution_failure ( self , diag, path_str, disambiguator, smallvec ! [ err] )
1298+ resolution_failure ( self , diag, path_str, disambiguator, smallvec ! [ err] ) ;
1299+ return vec ! [ ] ;
12991300 }
13001301 }
13011302 }
@@ -1331,13 +1332,14 @@ impl LinkCollector<'_, '_> {
13311332 . fold ( 0 , |acc, res| if let Ok ( res) = res { acc + res. len ( ) } else { acc } ) ;
13321333
13331334 if len == 0 {
1334- return resolution_failure (
1335+ resolution_failure (
13351336 self ,
13361337 diag,
13371338 path_str,
13381339 disambiguator,
13391340 candidates. into_iter ( ) . filter_map ( |res| res. err ( ) ) . collect ( ) ,
13401341 ) ;
1342+ return vec ! [ ] ;
13411343 } else if len == 1 {
13421344 candidates. into_iter ( ) . filter_map ( |res| res. ok ( ) ) . flatten ( ) . collect :: < Vec < _ > > ( )
13431345 } else {
@@ -1642,9 +1644,8 @@ fn resolution_failure(
16421644 path_str : & str ,
16431645 disambiguator : Option < Disambiguator > ,
16441646 kinds : SmallVec < [ ResolutionFailure < ' _ > ; 3 ] > ,
1645- ) -> Vec < ( Res , Option < DefId > ) > {
1647+ ) {
16461648 let tcx = collector. cx . tcx ;
1647- let mut recovered_res = None ;
16481649 report_diagnostic (
16491650 tcx,
16501651 BROKEN_INTRA_DOC_LINKS ,
@@ -1736,19 +1737,25 @@ fn resolution_failure(
17361737
17371738 if !path_str. contains ( "::" ) {
17381739 if disambiguator. map_or ( true , |d| d. ns ( ) == MacroNS )
1739- && let Some ( & res) = collector. cx . tcx . resolutions ( ( ) ) . all_macro_rules
1740- . get ( & Symbol :: intern ( path_str) )
1740+ && collector
1741+ . cx
1742+ . tcx
1743+ . resolutions ( ( ) )
1744+ . all_macro_rules
1745+ . get ( & Symbol :: intern ( path_str) )
1746+ . is_some ( )
17411747 {
17421748 diag. note ( format ! (
17431749 "`macro_rules` named `{path_str}` exists in this crate, \
17441750 but it is not in scope at this link's location"
17451751 ) ) ;
1746- recovered_res = res. try_into ( ) . ok ( ) . map ( |res| ( res, None ) ) ;
17471752 } else {
17481753 // If the link has `::` in it, assume it was meant to be an
17491754 // intra-doc link. Otherwise, the `[]` might be unrelated.
1750- diag. help ( "to escape `[` and `]` characters, \
1751- add '\\ ' before them like `\\ [` or `\\ ]`") ;
1755+ diag. help (
1756+ "to escape `[` and `]` characters, \
1757+ add '\\ ' before them like `\\ [` or `\\ ]`",
1758+ ) ;
17521759 }
17531760 }
17541761
@@ -1854,11 +1861,6 @@ fn resolution_failure(
18541861 }
18551862 } ,
18561863 ) ;
1857-
1858- match recovered_res {
1859- Some ( r) => vec ! [ r] ,
1860- None => Vec :: new ( ) ,
1861- }
18621864}
18631865
18641866fn report_multiple_anchors ( cx : & DocContext < ' _ > , diag_info : DiagnosticInfo < ' _ > ) {
0 commit comments