Skip to content

Commit bc84208

Browse files
petrochenkovMark-Simulacrum
authored andcommitted
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 de82c91 commit bc84208

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/librustdoc/clean/utils.rs

Lines changed: 0 additions & 4 deletions
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
use crate::visit_lib::LibEmbargoVisitor;
1211

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pub trait Trait {
2+
/// [`u8::clone`]
3+
fn method();
4+
}
Lines changed: 8 additions & 0 deletions
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)