about summary refs log tree commit diff
path: root/src/librustdoc/formats/renderer.rs
diff options
context:
space:
mode:
authorNixon Enraght-Moony <nixon.emoony@gmail.com>2021-03-24 15:54:20 +0000
committerNixon Enraght-Moony <nixon.emoony@gmail.com>2021-03-24 16:54:13 +0000
commit9ba92972ed6a1a39afa5993da97e016eea907be2 (patch)
tree5559412e5521051f794cf4254f9ec335b0e80810 /src/librustdoc/formats/renderer.rs
parentce21447c01c8ea6ce4f4c9dd2c18266439200f1d (diff)
downloadrust-9ba92972ed6a1a39afa5993da97e016eea907be2.tar.gz
rust-9ba92972ed6a1a39afa5993da97e016eea907be2.zip
Don't call `item` on modules for json renderer
Closes #80664
Diffstat (limited to 'src/librustdoc/formats/renderer.rs')
-rw-r--r--src/librustdoc/formats/renderer.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs
index 9dcef3a20d6..4e0f3a4e3c3 100644
--- a/src/librustdoc/formats/renderer.rs
+++ b/src/librustdoc/formats/renderer.rs
@@ -13,6 +13,11 @@ crate trait FormatRenderer<'tcx>: Sized {
     /// Gives a description of the renderer. Used for performance profiling.
     fn descr() -> &'static str;
 
+    /// Whether to call `item` recursivly for modules
+    ///
+    /// This is true for html, and false for json. See #80664
+    const RUN_ON_MODULE: bool;
+
     /// Sets up any state required for the renderer. When this is called the cache has already been
     /// populated.
     fn init(
@@ -68,7 +73,7 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
 
     let unknown = Symbol::intern("<unknown item>");
     while let Some((mut cx, item)) = work.pop() {
-        if item.is_mod() {
+        if item.is_mod() && T::RUN_ON_MODULE {
             // modules are special because they add a namespace. We also need to
             // recurse into the items of the module as well.
             let name = item.name.as_ref().unwrap().to_string();