From e62880676ad0c2ec908c20c1f3234f0629de64d2 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 23 Feb 2026 16:25:27 +0100 Subject: [PATCH] rustdoc: Improve sentence for documented empty impl blocks --- src/librustdoc/html/render/mod.rs | 7 ++++--- tests/rustdoc-html/impl/empty-impl-block.rs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 5d6909f0bb97..556d383a0e9f 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2343,9 +2343,10 @@ fn render_impl_summary( if let Some(doc) = doc { if impl_is_empty { w.write_str( - "
\ -
This impl block contains no items.
\ -
", + "\ +
\ +
This impl block contains no public items.
\ +
", )?; } write!(w, "
{doc}
")?; diff --git a/tests/rustdoc-html/impl/empty-impl-block.rs b/tests/rustdoc-html/impl/empty-impl-block.rs index 91fd4a64ef93..7ca5813aae2e 100644 --- a/tests/rustdoc-html/impl/empty-impl-block.rs +++ b/tests/rustdoc-html/impl/empty-impl-block.rs @@ -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.