Skip to content

Commit 59b8ff9

Browse files
committed
rustdoc: Do not add external traits to the crate in register_res
It's not clear why it was done, and apparently it's no longer necessary now. Such additions are unpredictable for early doc link resolution and would force us to collect all doc links from all external traits.
1 parent fab0432 commit 59b8ff9

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/librustdoc/clean/utils.rs

-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::clean::{
77
PathSegment, Primitive, PrimitiveType, Type, TypeBinding, Visibility,
88
};
99
use crate::core::DocContext;
10-
use crate::formats::item_type::ItemType;
1110

1211
use rustc_ast as ast;
1312
use rustc_ast::tokenstream::TokenTree;
@@ -503,9 +502,6 @@ pub(crate) fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId {
503502
return did;
504503
}
505504
inline::record_extern_fqn(cx, did, kind);
506-
if let ItemType::Trait = kind {
507-
inline::record_extern_trait(cx, did);
508-
}
509505
did
510506
}
511507

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pub trait Trait {
2+
/// [`u8::clone`]
3+
fn method();
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// The `Trait` is not pulled into the crate resulting in doc links in its methods being resolved.
2+
3+
// aux-build:issue-103463-aux.rs
4+
5+
extern crate issue_103463_aux;
6+
use issue_103463_aux::Trait;
7+
8+
fn main() {}

0 commit comments

Comments
 (0)