Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8ed7d93

Browse files
committed
Take DiagnosticInfo in resolution_failure
1 parent d4011e1 commit 8ed7d93

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,11 +1023,9 @@ impl LinkCollector<'_, '_> {
10231023
debug!("attempting to resolve item without parent module: {}", path_str);
10241024
resolution_failure(
10251025
self,
1026-
&item,
1026+
diag_info,
10271027
path_str,
10281028
disambiguator,
1029-
dox,
1030-
ori_link.range,
10311029
smallvec![ResolutionFailure::NoParentItem],
10321030
);
10331031
return None;
@@ -1073,11 +1071,9 @@ impl LinkCollector<'_, '_> {
10731071
debug!("link has malformed generics: {}", path_str);
10741072
resolution_failure(
10751073
self,
1076-
&item,
1074+
diag_info,
10771075
path_str,
10781076
disambiguator,
1079-
dox,
1080-
ori_link.range,
10811077
smallvec![err_kind],
10821078
);
10831079
return None;
@@ -1337,15 +1333,7 @@ impl LinkCollector<'_, '_> {
13371333
}
13381334
}
13391335
}
1340-
resolution_failure(
1341-
self,
1342-
diag.item,
1343-
path_str,
1344-
disambiguator,
1345-
diag.dox,
1346-
diag.link_range,
1347-
smallvec![kind],
1348-
);
1336+
resolution_failure(self, diag, path_str, disambiguator, smallvec![kind]);
13491337
// This could just be a normal link or a broken link
13501338
// we could potentially check if something is
13511339
// "intra-doc-link-like" and warn in that case.
@@ -1406,11 +1394,9 @@ impl LinkCollector<'_, '_> {
14061394
if len == 0 {
14071395
resolution_failure(
14081396
self,
1409-
diag.item,
1397+
diag,
14101398
path_str,
14111399
disambiguator,
1412-
diag.dox,
1413-
diag.link_range,
14141400
candidates.into_iter().filter_map(|res| res.err()).collect(),
14151401
);
14161402
// this could just be a normal link
@@ -1452,15 +1438,7 @@ impl LinkCollector<'_, '_> {
14521438
break;
14531439
}
14541440
}
1455-
resolution_failure(
1456-
self,
1457-
diag.item,
1458-
path_str,
1459-
disambiguator,
1460-
diag.dox,
1461-
diag.link_range,
1462-
smallvec![kind],
1463-
);
1441+
resolution_failure(self, diag, path_str, disambiguator, smallvec![kind]);
14641442
None
14651443
}
14661444
}
@@ -1750,11 +1728,9 @@ fn report_diagnostic(
17501728
/// `std::io::Error::x`, this will resolve `std::io::Error`.
17511729
fn resolution_failure(
17521730
collector: &mut LinkCollector<'_, '_>,
1753-
item: &Item,
1731+
DiagnosticInfo { item, ori_link: _, dox, link_range }: DiagnosticInfo<'_>,
17541732
path_str: &str,
17551733
disambiguator: Option<Disambiguator>,
1756-
dox: &str,
1757-
link_range: Range<usize>,
17581734
kinds: SmallVec<[ResolutionFailure<'_>; 3]>,
17591735
) {
17601736
let tcx = collector.cx.tcx;

0 commit comments

Comments
 (0)