Rollup merge of #153020 - GuillaumeGomez:improve-empty-impl-blocks-sentence, r=Urgau

rustdoc: Improve sentence for documented empty impl blocks

Part of rust-lang/rust#152874.

An impl block is not necessarily empty, so instead, better to precise that there are no **public** items.

r? @Urgau
This commit is contained in:
Jonathan Brouwer
2026-02-23 20:46:16 +01:00
committed by GitHub
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -2343,9 +2343,10 @@ fn render_impl_summary(
if let Some(doc) = doc {
if impl_is_empty {
w.write_str(
"<div class=\"item-info\">\
<div class=\"stab empty-impl\">This impl block contains no items.</div>\
</div>",
"\
<div class=\"item-info\">\
<div class=\"stab empty-impl\">This impl block contains no public items.</div>\
</div>",
)?;
}
write!(w, "<div class=\"docblock\">{doc}</div>")?;
+1 -1
View File
@@ -4,7 +4,7 @@
pub struct Foo;
//@ has - '//*[@class="docblock"]' 'Hello empty impl block!'
//@ has - '//*[@class="item-info"]' 'This impl block contains no items.'
//@ has - '//*[@class="item-info"]' 'This impl block contains no public items.'
/// Hello empty impl block!
impl Foo {}
// We ensure that this empty impl block without doc isn't rendered.