Skip to content

Commit bfd2b34

Browse files
handle local names when registering FQNs
1 parent a893117 commit bfd2b34

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
@@ -159,12 +159,11 @@ pub fn load_attrs(cx: &DocContext, did: DefId) -> clean::Attributes {
159159
/// These names are used later on by HTML rendering to generate things like
160160
/// source links back to the original item.
161161
pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
162+
let mut crate_name = cx.tcx.crate_name(did.krate).to_string();
162163
if did.is_local() {
163-
debug!("record_extern_fqn(did={:?}, kind+{:?}): def_id is local, aborting", did, kind);
164-
return;
164+
crate_name = cx.crate_name.clone().unwrap_or(crate_name);
165165
}
166166

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

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

0 commit comments

Comments
 (0)