about summary refs log tree commit diff
path: root/src/librustdoc/formats/renderer.rs
diff options
context:
space:
mode:
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 f0b390add73..ae97cd64fb5 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(
@@ -73,7 +78,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();