-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for tuple struct field documentation #87451
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ec76b6e
Add support for tuple structs' fields documentation
GuillaumeGomez 19f30b7
Add test for tuple struct documentation fields
GuillaumeGomez 2b79094
Add support for tuple struct fields documentation in enums as well
GuillaumeGomez fbf78e1
Add test for enum item tuple fields documentation
GuillaumeGomez c4aa735
Add explanations for why we use Variant::Struct instead of Variant::T…
GuillaumeGomez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,7 +1,7 @@ | ||
+-------------------------------------+------------+------------+------------+------------+ | ||
| File | Documented | Percentage | Examples | Percentage | | ||
+-------------------------------------+------------+------------+------------+------------+ | ||
| ...est/rustdoc-ui/coverage/enums.rs | 6 | 75.0% | 0 | 0.0% | | ||
| ...est/rustdoc-ui/coverage/enums.rs | 6 | 66.7% | 0 | 0.0% | | ||
+-------------------------------------+------------+------------+------------+------------+ | ||
| Total | 6 | 75.0% | 0 | 0.0% | | ||
| Total | 6 | 66.7% | 0 | 0.0% | | ||
+-------------------------------------+------------+------------+------------+------------+ |
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,36 @@ | ||
#![crate_name = "foo"] | ||
|
||
// @has foo/struct.Foo.html | ||
// @has - '//h2[@id="fields"]' 'Tuple Fields' | ||
// @has - '//h3[@class="sidebar-title"]/a[@href="#fields"]' 'Tuple Fields' | ||
// @has - '//*[@id="structfield.0"]' '0: u32' | ||
// @has - '//*[@id="main"]/div[@class="docblock"]' 'hello' | ||
// @!has - '//*[@id="structfield.1"]' | ||
// @has - '//*[@id="structfield.2"]' '2: char' | ||
// @has - '//*[@id="structfield.3"]' '3: i8' | ||
// @has - '//*[@id="main"]/div[@class="docblock"]' 'not hello' | ||
pub struct Foo( | ||
/// hello | ||
pub u32, | ||
char, | ||
pub char, | ||
/// not hello | ||
pub i8, | ||
); | ||
GuillaumeGomez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// @has foo/enum.Bar.html | ||
// @has - '//pre[@class="rust enum"]' 'BarVariant(String),' | ||
// @matches - '//*[@id="variant.BarVariant.fields"]/h3' '^Tuple Fields of BarVariant$' | ||
// @has - '//*[@id="variant.BarVariant.field.0"]' '0: String' | ||
// @has - '//*[@id="variant.BarVariant.fields"]//*[@class="docblock"]' 'Hello docs' | ||
// @matches - '//*[@id="variant.FooVariant.fields"]/h3' '^Fields of FooVariant$' | ||
pub enum Bar { | ||
BarVariant( | ||
/// Hello docs | ||
String | ||
), | ||
FooVariant { | ||
/// hello | ||
x: u32, | ||
}, | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this cause #87887?
It seems like tuple variants no longer exist in the outputted json, but shouldn't tuple variants be described as tuple variants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very likely yes.