summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-06-06 08:36:59 +0200
committerGitHub <noreply@github.com>2022-06-06 08:36:59 +0200
commit77f0209fde995458d39dbd5f58699b8ddfd04452 (patch)
tree63f67d5968d9f4363b11091f53595f3453a3629b /src/librustdoc/html/render
parent760237ff785fd14ac7fdab799f4d695d86cf9cbf (diff)
parenteca12e33e9aca609b6409625f6a617d03bc479d3 (diff)
downloadrust-77f0209fde995458d39dbd5f58699b8ddfd04452.tar.gz
rust-77f0209fde995458d39dbd5f58699b8ddfd04452.zip
Rollup merge of #90905 - GuillaumeGomez:empty-impl-blocks, r=jsha
Add empty impl blocks if they have documentation

Fixes https://github.com/rust-lang/rust/issues/90866.

The update for the test script is needed to count the number of impl blocks we have with only the struct. To be noted that with https://github.com/rust-lang/rust/pull/89676 merged, it wouldn't be needed (I don't know what is the status of it btw. cc ```@Mark-Simulacrum).```

It looks like this:

![Screenshot from 2021-11-14 16-51-28](https://user-images.githubusercontent.com/3050060/141689100-e57123c0-bf50-4c42-adf5-d991e169a0e4.png)

cc ```@jyn514```
r? ```@camelid```
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 23ce634cf28..cb887d16906 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1600,6 +1600,13 @@ fn render_impl(
         }
 
         if let Some(ref dox) = i.impl_item.collapsed_doc_value() {
+            if trait_.is_none() && i.inner_impl().items.is_empty() {
+                w.write_str(
+                    "<div class=\"item-info\">\
+                    <div class=\"stab empty-impl\">This impl block contains no items.</div>
+                </div>",
+                );
+            }
             write!(
                 w,
                 "<div class=\"docblock\">{}</div>",