Skip to content

Commit 6e3c77e

Browse files
Remove intra-docs check for items from dependencies
1 parent 913ad6d commit 6e3c77e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Diff for: src/librustdoc/clean/inline.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ pub fn try_inline(
4040
def: Def,
4141
name: ast::Name,
4242
visited: &mut FxHashSet<DefId>
43-
)
44-
-> Option<Vec<clean::Item>> {
43+
) -> Option<Vec<clean::Item>> {
4544
let did = if let Some(did) = def.opt_def_id() {
4645
did
4746
} else {

Diff for: src/librustdoc/passes/collect_intra_doc_links.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
327327
if let Ok(def) = self.resolve(path_str, true, &current_item, parent_node) {
328328
def
329329
} else {
330-
resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
330+
resolution_failure(cx, &item, path_str, &dox, link_range);
331331
// This could just be a normal link or a broken link
332332
// we could potentially check if something is
333333
// "intra-doc-link-like" and warn in that case.
@@ -338,7 +338,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
338338
if let Ok(def) = self.resolve(path_str, false, &current_item, parent_node) {
339339
def
340340
} else {
341-
resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
341+
resolution_failure(cx, &item, path_str, &dox, link_range);
342342
// This could just be a normal link.
343343
continue;
344344
}
@@ -393,7 +393,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
393393
{
394394
value_def
395395
} else {
396-
resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
396+
resolution_failure(cx, &item, path_str, &dox, link_range);
397397
// this could just be a normal link
398398
continue;
399399
}
@@ -402,7 +402,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
402402
if let Some(def) = macro_resolve(cx, path_str) {
403403
(def, None)
404404
} else {
405-
resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
405+
resolution_failure(cx, &item, path_str, &dox, link_range);
406406
continue
407407
}
408408
}
@@ -464,11 +464,15 @@ fn macro_resolve(cx: &DocContext<'_>, path_str: &str) -> Option<Def> {
464464
/// line containing the failure as a note as well.
465465
fn resolution_failure(
466466
cx: &DocContext<'_>,
467-
attrs: &Attributes,
467+
item: &Item,
468468
path_str: &str,
469469
dox: &str,
470470
link_range: Option<Range<usize>>,
471471
) {
472+
if !item.def_id.is_local() { // We don't span warnings for items outside of the current crate.
473+
return;
474+
}
475+
let attrs = &item.attrs;
472476
let sp = span_of_attrs(attrs);
473477

474478
let mut diag = cx.tcx.struct_span_lint_hir(

0 commit comments

Comments
 (0)