Skip to content

Commit

Permalink
Take DiagnosticInfo in resolution_failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Apr 5, 2021
1 parent d4011e1 commit 8ed7d93
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Expand Up @@ -1023,11 +1023,9 @@ impl LinkCollector<'_, '_> {
debug!("attempting to resolve item without parent module: {}", path_str);
resolution_failure(
self,
&item,
diag_info,
path_str,
disambiguator,
dox,
ori_link.range,
smallvec![ResolutionFailure::NoParentItem],
);
return None;
Expand Down Expand Up @@ -1073,11 +1071,9 @@ impl LinkCollector<'_, '_> {
debug!("link has malformed generics: {}", path_str);
resolution_failure(
self,
&item,
diag_info,
path_str,
disambiguator,
dox,
ori_link.range,
smallvec![err_kind],
);
return None;
Expand Down Expand Up @@ -1337,15 +1333,7 @@ impl LinkCollector<'_, '_> {
}
}
}
resolution_failure(
self,
diag.item,
path_str,
disambiguator,
diag.dox,
diag.link_range,
smallvec![kind],
);
resolution_failure(self, diag, path_str, disambiguator, smallvec![kind]);
// This could just be a normal link or a broken link
// we could potentially check if something is
// "intra-doc-link-like" and warn in that case.
Expand Down Expand Up @@ -1406,11 +1394,9 @@ impl LinkCollector<'_, '_> {
if len == 0 {
resolution_failure(
self,
diag.item,
diag,
path_str,
disambiguator,
diag.dox,
diag.link_range,
candidates.into_iter().filter_map(|res| res.err()).collect(),
);
// this could just be a normal link
Expand Down Expand Up @@ -1452,15 +1438,7 @@ impl LinkCollector<'_, '_> {
break;
}
}
resolution_failure(
self,
diag.item,
path_str,
disambiguator,
diag.dox,
diag.link_range,
smallvec![kind],
);
resolution_failure(self, diag, path_str, disambiguator, smallvec![kind]);
None
}
}
Expand Down Expand Up @@ -1750,11 +1728,9 @@ fn report_diagnostic(
/// `std::io::Error::x`, this will resolve `std::io::Error`.
fn resolution_failure(
collector: &mut LinkCollector<'_, '_>,
item: &Item,
DiagnosticInfo { item, ori_link: _, dox, link_range }: DiagnosticInfo<'_>,
path_str: &str,
disambiguator: Option<Disambiguator>,
dox: &str,
link_range: Range<usize>,
kinds: SmallVec<[ResolutionFailure<'_>; 3]>,
) {
let tcx = collector.cx.tcx;
Expand Down

0 comments on commit 8ed7d93

Please sign in to comment.