@@ -1295,7 +1295,8 @@ impl LinkCollector<'_, '_> {
1295
1295
}
1296
1296
}
1297
1297
}
1298
- resolution_failure ( self , diag, path_str, disambiguator, smallvec ! [ err] )
1298
+ resolution_failure ( self , diag, path_str, disambiguator, smallvec ! [ err] ) ;
1299
+ return vec ! [ ] ;
1299
1300
}
1300
1301
}
1301
1302
}
@@ -1331,13 +1332,14 @@ impl LinkCollector<'_, '_> {
1331
1332
. fold ( 0 , |acc, res| if let Ok ( res) = res { acc + res. len ( ) } else { acc } ) ;
1332
1333
1333
1334
if len == 0 {
1334
- return resolution_failure (
1335
+ resolution_failure (
1335
1336
self ,
1336
1337
diag,
1337
1338
path_str,
1338
1339
disambiguator,
1339
1340
candidates. into_iter ( ) . filter_map ( |res| res. err ( ) ) . collect ( ) ,
1340
1341
) ;
1342
+ return vec ! [ ] ;
1341
1343
} else if len == 1 {
1342
1344
candidates. into_iter ( ) . filter_map ( |res| res. ok ( ) ) . flatten ( ) . collect :: < Vec < _ > > ( )
1343
1345
} else {
@@ -1642,9 +1644,8 @@ fn resolution_failure(
1642
1644
path_str : & str ,
1643
1645
disambiguator : Option < Disambiguator > ,
1644
1646
kinds : SmallVec < [ ResolutionFailure < ' _ > ; 3 ] > ,
1645
- ) -> Vec < ( Res , Option < DefId > ) > {
1647
+ ) {
1646
1648
let tcx = collector. cx . tcx ;
1647
- let mut recovered_res = None ;
1648
1649
report_diagnostic (
1649
1650
tcx,
1650
1651
BROKEN_INTRA_DOC_LINKS ,
@@ -1736,19 +1737,25 @@ fn resolution_failure(
1736
1737
1737
1738
if !path_str. contains ( "::" ) {
1738
1739
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 ( )
1741
1747
{
1742
1748
diag. note ( format ! (
1743
1749
"`macro_rules` named `{path_str}` exists in this crate, \
1744
1750
but it is not in scope at this link's location"
1745
1751
) ) ;
1746
- recovered_res = res. try_into ( ) . ok ( ) . map ( |res| ( res, None ) ) ;
1747
1752
} else {
1748
1753
// If the link has `::` in it, assume it was meant to be an
1749
1754
// 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
+ ) ;
1752
1759
}
1753
1760
}
1754
1761
@@ -1854,11 +1861,6 @@ fn resolution_failure(
1854
1861
}
1855
1862
} ,
1856
1863
) ;
1857
-
1858
- match recovered_res {
1859
- Some ( r) => vec ! [ r] ,
1860
- None => Vec :: new ( ) ,
1861
- }
1862
1864
}
1863
1865
1864
1866
fn report_multiple_anchors ( cx : & DocContext < ' _ > , diag_info : DiagnosticInfo < ' _ > ) {
0 commit comments