rustdoc: Test & document test_harness code block attribute#148183
rustdoc: Test & document test_harness code block attribute#148183fmease wants to merge 1 commit into
test_harness code block attribute#148183Conversation
|
rustbot has assigned @GuillaumeGomez. Use |
| @@ -847,11 +847,12 @@ pub(crate) enum Ignore { | |||
| Some(Vec<String>), | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
It's not any old ENBF1 (variant), it's ABNF2 specifically (from IETF RFC 5234) which I previously didn't know about (and thus was confused about the syntax).
Footnotes
| /// delimited-attribute-list = OPEN-CURLY-BRACKET attribute-list CLOSE-CURLY-BRACKET | ||
| /// token-list = [sep] token *(sep token) [sep] | ||
| /// comment = OPEN_PAREN *(all characters) CLOSE_PAREN | ||
| /// comment = OPEN_PAREN *<all characters except closing parentheses> CLOSE_PAREN |
There was a problem hiding this comment.
Prose terminals are to be denoted by <…> not by (…) (which is grouping) per IETF RFC 5234 (Ctrl+F for prose-val).
eab1d61 to
5e7f083
Compare
This comment has been minimized.
This comment has been minimized.
5e7f083 to
c687f89
Compare
This comment has been minimized.
This comment has been minimized.
c687f89 to
f71d897
Compare
This comment has been minimized.
This comment has been minimized.
f71d897 to
9a78729
Compare
This comment has been minimized.
This comment has been minimized.
9a78729 to
3a17eba
Compare
| Code blocks can be annotated with attributes that help `rustdoc` do the right | ||
| thing when testing your code: | ||
| Code blocks can be annotated with attributes that tell `rustdoc` how to build and interpret the test. | ||
| They follow the triple backtick in the opening line. |
There was a problem hiding this comment.
Not necessarily triple, it can be ten if you want. ^^'
There was a problem hiding this comment.
So I'd say (or something along the lines):
| They follow the triple backtick in the opening line. | |
| They follow the backticks marking the beginning of the code block. |
There was a problem hiding this comment.
Yea it can also be ~~~ ^^'. I've used triple backtick because that's what's also used at the top of the file. We do link to the CommonMark spec later for the full rules.
But yeah, I should probably rephrase that.
There was a problem hiding this comment.
I keep forgetting about ~~~... Markdown is too flexible 😅
There was a problem hiding this comment.
Replaced with code fence + a link to the relevant part of the CommonMark spec.
| They follow the triple backtick in the opening line. | ||
| As such, they share the place with language strings like `rust` or `text`. | ||
| Multiple attributes can be provided by separating them with commas, spaces or tabs. | ||
| You can also write comments which are enclosed in parentheses `(…)`. |
There was a problem hiding this comment.
Maybe link to the relevant part of the book which explains the syntax of codeblock attributes instead?
There was a problem hiding this comment.
This is the part of the book about codeblock attributes. We didn't have any documentation in the Book about this before.
|
A quick github code search reveals this is in fact used in the wild. |
3a17eba to
f13978f
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot review |
|
This pull request was unapproved. This PR was contained in a rollup (#157502), which was unapproved. |
|
This is so sad, there's no official (cross-platform) way to pass libtest arguments to the inner test harness, that's pretty sad but kinda obvious in hindsight; I'm crying, do I need to abuse runtools now? |
|
I won't judge if you do. :3 |
f13978f to
5706bfe
Compare
|
@bors try jobs=aarch64-gnu-llvm-21-1 |
This comment has been minimized.
This comment has been minimized.
…s, r=<try> rustdoc: Test & document `test_harness` code block attribute try-job: aarch64-gnu-llvm-21-1
This comment has been minimized.
This comment has been minimized.
|
💔 Test for fa2c91f failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
5706bfe to
4f88c4d
Compare
|
@bors try jobs=x86_64-msvc-1,aarch64-gnu-llvm-21-1 |
This comment has been minimized.
This comment has been minimized.
…s, r=<try> rustdoc: Test & document `test_harness` code block attribute try-job: x86_64-msvc-1 try-job: aarch64-gnu-llvm-21-1
|
💔 Test for 2fe156a failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
4f88c4d to
a918066
Compare
Moreover, flesh out the rustdoc book section about code block attributes.
|
@bors try jobs=x86_64-msvc-1 |
This comment has been minimized.
This comment has been minimized.
…s, r=<try> rustdoc: Test & document `test_harness` code block attribute try-job: x86_64-msvc-1
|
Final try-builds still needs to come back clean of course but this is now ready for re-review. I've basically split out the problematic part out of the rustdoc-UI test into a new run-make test. |
|
💔 Test for acf5f03 failed: CI. Failed job:
|
|
The job Click to see the possible cause of the failure (guessed by this bot) |
View all comments
They were fully untested and undocumented previously despite being stable.
Context: #t-rustdoc > `test_harness` langstr @ 💬.
While at it, I've also improved the documentation for code block attributes in general.
I was only inspired to do so because there was no good place for
test_harnessand because it got hard to skim due to a lack of subsubsections.