Skip to content

Commit 8156b9a

Browse files
P1n3appl3jyn514
authored andcommitted
Fix re-exports and extern-crate
1 parent 3506135 commit 8156b9a

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

src/librustdoc/json/mod.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,29 @@ impl FormatRenderer for JsonRenderer {
151151
}
152152

153153
fn item(&mut self, item: clean::Item, cache: &Cache) -> Result<(), Error> {
154-
use clean::ItemEnum::*;
155154
// Flatten items that recursively store other items by inserting them into the index
156-
if let ModuleItem(_) = &item.inner {
157-
// but ignore modules because we handle recursing into them separately
158-
} else {
159-
item.inner.inner_items().for_each(|i| self.item(i.clone(), cache).unwrap())
160-
}
155+
item.inner.inner_items().for_each(|i| self.item(i.clone(), cache).unwrap());
161156
self.insert(item.clone(), cache);
162157
Ok(())
163158
}
164159

165160
fn mod_item_in(
166161
&mut self,
167162
item: &clean::Item,
168-
_item_name: &str,
163+
_module_name: &str,
169164
cache: &Cache,
170165
) -> Result<(), Error> {
166+
use clean::types::ItemEnum::*;
167+
if let ModuleItem(m) = &item.inner {
168+
for item in &m.items {
169+
match item.inner {
170+
// These don't have names so they don't get added to the output by default
171+
ImportItem(_) => self.insert(item.clone(), cache),
172+
ExternCrateItem(_, _) => self.insert(item.clone(), cache),
173+
_ => {}
174+
}
175+
}
176+
}
171177
self.insert(item.clone(), cache);
172178
Ok(())
173179
}

src/librustdoc/json/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub enum Visibility {
101101
/// public traits and variants of public enums.
102102
Default,
103103
Crate,
104-
// TODO: Restricted(Id, String),
104+
// FIXME(pineapple): add support for restricted paths
105105
}
106106

107107
#[serde(rename_all = "snake_case")]
@@ -440,7 +440,7 @@ pub struct Import {
440440
/// `use source as name;`
441441
pub name: String,
442442
/// The ID of the item being imported.
443-
pub id: Option<Id>, // TODO: when is this None?
443+
pub id: Option<Id>, // TODO when is this None?
444444
/// Whether this import uses a glob: `use source::*;`
445445
pub glob: bool,
446446
}

src/test/run-make-fulldeps/rustdoc-json/check_missing_items.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ def check_type(ty):
115115
visited.add(current)
116116
item = get_local_item(current)
117117
# check intradoc links
118-
work_list |= set(item["links"].values()) - visited
118+
for (_name, link) in item["links"].items():
119+
if not valid_id(link):
120+
print("Intra-doc link contains invalid ID:", link)
119121

120122
# check all fields that reference types such as generics as well as nested items
121123
# (modules, structs, traits, and enums)

0 commit comments

Comments
 (0)