Take DiagnosticInfo in resolution_failure

This commit is contained in:
Joshua Nelson 2021-04-05 05:01:15 -04:00
parent d4011e1270
commit 8ed7d936f8

View File

@ -1023,11 +1023,9 @@ impl LinkCollector<'_, '_> {
debug!("attempting to resolve item without parent module: {}", path_str); debug!("attempting to resolve item without parent module: {}", path_str);
resolution_failure( resolution_failure(
self, self,
&item, diag_info,
path_str, path_str,
disambiguator, disambiguator,
dox,
ori_link.range,
smallvec![ResolutionFailure::NoParentItem], smallvec![ResolutionFailure::NoParentItem],
); );
return None; return None;
@ -1073,11 +1071,9 @@ impl LinkCollector<'_, '_> {
debug!("link has malformed generics: {}", path_str); debug!("link has malformed generics: {}", path_str);
resolution_failure( resolution_failure(
self, self,
&item, diag_info,
path_str, path_str,
disambiguator, disambiguator,
dox,
ori_link.range,
smallvec![err_kind], smallvec![err_kind],
); );
return None; return None;
@ -1337,15 +1333,7 @@ impl LinkCollector<'_, '_> {
} }
} }
} }
resolution_failure( resolution_failure(self, diag, path_str, disambiguator, smallvec![kind]);
self,
diag.item,
path_str,
disambiguator,
diag.dox,
diag.link_range,
smallvec![kind],
);
// This could just be a normal link or a broken link // This could just be a normal link or a broken link
// we could potentially check if something is // we could potentially check if something is
// "intra-doc-link-like" and warn in that case. // "intra-doc-link-like" and warn in that case.
@ -1406,11 +1394,9 @@ impl LinkCollector<'_, '_> {
if len == 0 { if len == 0 {
resolution_failure( resolution_failure(
self, self,
diag.item, diag,
path_str, path_str,
disambiguator, disambiguator,
diag.dox,
diag.link_range,
candidates.into_iter().filter_map(|res| res.err()).collect(), candidates.into_iter().filter_map(|res| res.err()).collect(),
); );
// this could just be a normal link // this could just be a normal link
@ -1452,15 +1438,7 @@ impl LinkCollector<'_, '_> {
break; break;
} }
} }
resolution_failure( resolution_failure(self, diag, path_str, disambiguator, smallvec![kind]);
self,
diag.item,
path_str,
disambiguator,
diag.dox,
diag.link_range,
smallvec![kind],
);
None None
} }
} }
@ -1750,11 +1728,9 @@ fn report_diagnostic(
/// `std::io::Error::x`, this will resolve `std::io::Error`. /// `std::io::Error::x`, this will resolve `std::io::Error`.
fn resolution_failure( fn resolution_failure(
collector: &mut LinkCollector<'_, '_>, collector: &mut LinkCollector<'_, '_>,
item: &Item, DiagnosticInfo { item, ori_link: _, dox, link_range }: DiagnosticInfo<'_>,
path_str: &str, path_str: &str,
disambiguator: Option<Disambiguator>, disambiguator: Option<Disambiguator>,
dox: &str,
link_range: Range<usize>,
kinds: SmallVec<[ResolutionFailure<'_>; 3]>, kinds: SmallVec<[ResolutionFailure<'_>; 3]>,
) { ) {
let tcx = collector.cx.tcx; let tcx = collector.cx.tcx;