Skip to content

Commit 5254548

Browse files
handle local names when registering FQNs
1 parent 825126a commit 5254548

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,11 @@ pub fn load_attrs(cx: &DocContext, did: DefId) -> clean::Attributes {
158158
/// These names are used later on by HTML rendering to generate things like
159159
/// source links back to the original item.
160160
pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
161+
let mut crate_name = cx.tcx.crate_name(did.krate).to_string();
161162
if did.is_local() {
162-
debug!("record_extern_fqn(did={:?}, kind+{:?}): def_id is local, aborting", did, kind);
163-
return;
163+
crate_name = cx.crate_name.clone().unwrap_or(crate_name);
164164
}
165165

166-
let crate_name = cx.tcx.crate_name(did.krate).to_string();
167166
let relative = cx.tcx.def_path(did).data.into_iter().filter_map(|elem| {
168167
// extern blocks have an empty name
169168
let s = elem.data.to_string();
@@ -178,7 +177,12 @@ pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
178177
} else {
179178
once(crate_name).chain(relative).collect()
180179
};
181-
cx.renderinfo.borrow_mut().external_paths.insert(did, (fqn, kind));
180+
181+
if did.is_local() {
182+
cx.renderinfo.borrow_mut().exact_paths.insert(did, fqn);
183+
} else {
184+
cx.renderinfo.borrow_mut().external_paths.insert(did, (fqn, kind));
185+
}
182186
}
183187

184188
pub fn build_external_trait(cx: &DocContext, did: DefId) -> clean::Trait {

0 commit comments

Comments
 (0)