Skip to content

Commit

Permalink
rustdoc: Do not add external traits to the crate in register_res
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
petrochenkov committed Oct 30, 2022
1 parent fab0432 commit 59b8ff9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::clean::{
PathSegment, Primitive, PrimitiveType, Type, TypeBinding, Visibility,
};
use crate::core::DocContext;
use crate::formats::item_type::ItemType;

use rustc_ast as ast;
use rustc_ast::tokenstream::TokenTree;
Expand Down Expand Up @@ -503,9 +502,6 @@ pub(crate) fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId {
return did;
}
inline::record_extern_fqn(cx, did, kind);
if let ItemType::Trait = kind {
inline::record_extern_trait(cx, did);
}
did
}

Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc/intra-doc/auxiliary/issue-103463-aux.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub trait Trait {
/// [`u8::clone`]
fn method();
}
8 changes: 8 additions & 0 deletions src/test/rustdoc/intra-doc/issue-103463.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// The `Trait` is not pulled into the crate resulting in doc links in its methods being resolved.

// aux-build:issue-103463-aux.rs

extern crate issue_103463_aux;
use issue_103463_aux::Trait;

fn main() {}

0 comments on commit 59b8ff9

Please sign in to comment.