Skip to content

Commit 661acbc

Browse files
committed
Take DiagnosticInfo in privacy_error
1 parent f4c87c5 commit 661acbc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ impl LinkCollector<'_, '_> {
11921192
if self.cx.tcx.privacy_access_levels(LOCAL_CRATE).is_exported(hir_src)
11931193
&& !self.cx.tcx.privacy_access_levels(LOCAL_CRATE).is_exported(hir_dst)
11941194
{
1195-
privacy_error(self.cx, &item, &path_str, dox, &ori_link);
1195+
privacy_error(self.cx, diag_info, &path_str);
11961196
}
11971197
}
11981198

@@ -2045,7 +2045,11 @@ fn suggest_disambiguator(
20452045
}
20462046

20472047
/// Report a link from a public item to a private one.
2048-
fn privacy_error(cx: &DocContext<'_>, item: &Item, path_str: &str, dox: &str, link: &MarkdownLink) {
2048+
fn privacy_error(
2049+
cx: &DocContext<'_>,
2050+
DiagnosticInfo { item, ori_link: _, dox, link_range }: DiagnosticInfo<'_>,
2051+
path_str: &str,
2052+
) {
20492053
let sym;
20502054
let item_name = match item.name {
20512055
Some(name) => {
@@ -2057,7 +2061,7 @@ fn privacy_error(cx: &DocContext<'_>, item: &Item, path_str: &str, dox: &str, li
20572061
let msg =
20582062
format!("public documentation for `{}` links to private item `{}`", item_name, path_str);
20592063

2060-
report_diagnostic(cx.tcx, PRIVATE_INTRA_DOC_LINKS, &msg, item, dox, &link.range, |diag, sp| {
2064+
report_diagnostic(cx.tcx, PRIVATE_INTRA_DOC_LINKS, &msg, item, dox, &link_range, |diag, sp| {
20612065
if let Some(sp) = sp {
20622066
diag.span_label(sp, "this item is private");
20632067
}

0 commit comments

Comments
 (0)