forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#115604 - GuillaumeGomez:private-fields-tupl…
…e-struct, r=notriddle rustdoc: Render private fields in tuple struct as `/* private fields */` Reopening of rust-lang#110552. All that was missing was a test for the different cases so I added it into the second commit. Description from the original PR: > I've gotten some feedback that the current rustdoc rendering of... > > ``` > struct HasPrivateFields(_); > ``` > > ...is confusing, and I agree with that feedback, especially compared to the field struct case: > > ``` > struct HasPrivateFields { /* private fields */ } > ``` > > So this PR makes it so that when all of the fields of a tuple variant are private, just render it with the `/* private fields */` comment. We can't *always* render it like that, for example when there's a mix of private and public fields. cc ```@jsha``` r? ```@notriddle```
- Loading branch information
Showing
8 changed files
with
53 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#![crate_name = "foo"] | ||
|
||
// @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \ | ||
// 'pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(_);' | ||
// 'pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(' | ||
pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(T); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This test checks the diplay of "/* private fields */" sentence in tuple structs. | ||
#![crate_name = "foo"] | ||
|
||
// @has 'foo/struct.A.html' '//*[@class="rust item-decl"]/code' 'pub struct A(pub u8, _);' | ||
pub struct A(pub u8, u8); | ||
// @has 'foo/struct.B.html' '//*[@class="rust item-decl"]/code' 'pub struct B(_, pub u8);' | ||
pub struct B(u8, pub u8); | ||
// @has 'foo/struct.C.html' '//*[@class="rust item-decl"]/code' 'pub struct C(_, pub u8, _);' | ||
pub struct C(u8, pub u8, u8); | ||
// @has 'foo/struct.D.html' '//*[@class="rust item-decl"]/code' 'pub struct D(pub u8, _, pub u8);' | ||
pub struct D(pub u8, u8, pub u8); | ||
// @has 'foo/struct.E.html' '//*[@class="rust item-decl"]/code' 'pub struct E(/* private fields */);' | ||
pub struct E(u8); | ||
// @has 'foo/struct.F.html' '//*[@class="rust item-decl"]/code' 'pub struct F(/* private fields */);' | ||
pub struct F(u8, u8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<pre class="rust item-decl"><code>pub struct Simd<T>(_) | ||
<pre class="rust item-decl"><code>pub struct Simd<T>(/* private fields */) | ||
<span class="where">where | ||
T: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<code>pub struct Alpha<A>(_) | ||
<code>pub struct Alpha<A>(/* private fields */) | ||
<span class="where">where | ||
A: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters