about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-12 07:12:09 +0100
committerGitHub <noreply@github.com>2022-01-12 07:12:09 +0100
commitb24b0fdcd0e7c1f003a3441bda83c6f9ece17ab8 (patch)
tree0d34c5c61888609cca62caf40429b0f6521acb64 /src/test/rustdoc
parent9ea9e1851d19f86a13659995244c617d6eb5d8bd (diff)
parent2b70a3df7a73b283e7f19439a98c81bb66f6a852 (diff)
downloadrust-b24b0fdcd0e7c1f003a3441bda83c6f9ece17ab8.tar.gz
rust-b24b0fdcd0e7c1f003a3441bda83c6f9ece17ab8.zip
Rollup merge of #92699 - camelid:private-fields, r=jsha
rustdoc: Display "private fields" instead of "fields omitted"

Also:

  * Always use `/* */` block comments
  * Use the same message everywhere, rather than sometimes prefixing
    with "some"

When I first read rustdoc docs, I was confused why the fields were being
omitted. It was only later that I realized it was because they were
private. It's also always bothered me that rustdoc sometimes uses `//`
and sometimes uses `/*` comments for these messages, so this change
makes them all use `/*`.

Technically, I think fields can be omitted if they are public but
`doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's
really just used to emulate "doc privacy" when -- because of technical
limitations -- an item has to be public. So I think it's fine to include
this under the category of "private fields".

r? ```@jsha```
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/structfields.rs8
-rw-r--r--src/test/rustdoc/toggle-item-contents.rs2
-rw-r--r--src/test/rustdoc/union.rs2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/test/rustdoc/structfields.rs b/src/test/rustdoc/structfields.rs
index 6de198453cd..7e1cada4b98 100644
--- a/src/test/rustdoc/structfields.rs
+++ b/src/test/rustdoc/structfields.rs
@@ -2,7 +2,7 @@
 pub struct Foo {
     // @has - //pre "pub a: ()"
     pub a: (),
-    // @has - //pre "// some fields omitted"
+    // @has - //pre "/* private fields */"
     // @!has - //pre "b: ()"
     b: (),
     // @!has - //pre "c: usize"
@@ -16,7 +16,7 @@ pub struct Foo {
 pub struct Bar {
     // @has - //pre "pub a: ()"
     pub a: (),
-    // @!has - //pre "// some fields omitted"
+    // @!has - //pre "/* private fields */"
 }
 
 // @has structfields/enum.Qux.html
@@ -29,11 +29,11 @@ pub enum Qux {
         b: (),
         // @has - //pre "c: usize"
         c: usize,
-        // @has - //pre "// some fields omitted"
+        // @has - //pre "/* private fields */"
     },
 }
 
-// @has structfields/struct.Baz.html //pre "pub struct Baz { /* fields omitted */ }"
+// @has structfields/struct.Baz.html //pre "pub struct Baz { /* private fields */ }"
 pub struct Baz {
     x: u8,
     #[doc(hidden)]
diff --git a/src/test/rustdoc/toggle-item-contents.rs b/src/test/rustdoc/toggle-item-contents.rs
index 937646987dd..c1df4613e35 100644
--- a/src/test/rustdoc/toggle-item-contents.rs
+++ b/src/test/rustdoc/toggle-item-contents.rs
@@ -55,7 +55,7 @@ pub union Union {
 
 // @has 'toggle_item_contents/struct.PrivStruct.html'
 // @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
-// @has - '//div[@class="docblock item-decl"]' 'fields omitted'
+// @has - '//div[@class="docblock item-decl"]' '/* private fields */'
 pub struct PrivStruct {
     a: usize,
     b: usize,
diff --git a/src/test/rustdoc/union.rs b/src/test/rustdoc/union.rs
index 89186227732..5a788eb1b1c 100644
--- a/src/test/rustdoc/union.rs
+++ b/src/test/rustdoc/union.rs
@@ -2,7 +2,7 @@
 pub union U {
     // @has - //pre "pub a: u8"
     pub a: u8,
-    // @has - //pre "// some fields omitted"
+    // @has - //pre "/* private fields */"
     // @!has - //pre "b: u16"
     b: u16,
 }