-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustdoc: add option to abort the process on markdown differences #46883
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
r=me once CI passed. |
☔ The latest upstream changes (presumably #46874) made this pull request unmergeable. Please resolve the merge conflicts. |
#46853 has been merged. |
5cb3a92
to
d875318
Compare
Just rebased atop it. Let's see what travis says. |
src/librustdoc/lib.rs
Outdated
@@ -256,6 +256,9 @@ pub fn opts() -> Vec<RustcOptGroup> { | |||
unstable("sort-modules-by-appearance", |o| { | |||
o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the \ | |||
program, rather than alphabetically") | |||
unstable("deny-render-differences", |o| { |
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.
Missing }),
above this line 😒
[00:43:34] error: incorrect close delimiter: `]`
[00:43:34] --> /checkout/src/librustdoc/lib.rs:263:5
[00:43:34] |
[00:43:34] 263 | ]
[00:43:34] | ^
[00:43:34] |
[00:43:34] note: unclosed delimiter
[00:43:34] --> /checkout/src/librustdoc/lib.rs:256:52
[00:43:34] |
[00:43:34] 256 | unstable("sort-modules-by-appearance", |o| {
[00:43:34] | ^
[00:43:34]
[00:43:34] error: incorrect close delimiter: `]`
[00:43:34] --> /checkout/src/librustdoc/lib.rs:263:5
[00:43:34] |
[00:43:34] 263 | ]
[00:43:34] | ^
[00:43:34] |
[00:43:34] note: unclosed delimiter
[00:43:34] --> /checkout/src/librustdoc/lib.rs:256:17
[00:43:34] |
[00:43:34] 256 | unstable("sort-modules-by-appearance", |o| {
[00:43:34] | ^
[00:43:34]
[00:43:35] error: expected one of `.`, `;`, `?`, `}`, or an operator, found `unstable`
[00:43:35] --> /checkout/src/librustdoc/lib.rs:259:9
[00:43:35] |
[00:43:35] 258 | program, rather than alphabetically")
[00:43:35] | - expected one of `.`, `;`, `?`, `}`, or an operator here
[00:43:35] 259 | unstable("deny-render-differences", |o| {
[00:43:35] | ^^^^^^^^ unexpected token
[00:43:35]
[00:43:35] error: aborting due to 3 previous errors
[00:43:35]
[00:43:35] error: Could not compile `rustdoc`.
d875318
to
dfbb946
Compare
Whoops, fixed that now. Travis is green. |
@bors r=GuillaumeGomez |
📌 Commit dfbb946 has been approved by |
rustdoc: add option to abort the process on markdown differences In the efforts of keeping the std docs free of markdown warnings, this PR adds a stopgap measure to make sure the CI fails if it detects a markdown difference. It does this by adding a new unstable flag to rustdoc, `--deny-render-differences`, which bootstrap then passes to rustdoc when documenting std and friends. The implementation is... probably not the cleanest option. It currently adds an extra branch after it prints the markdown warnings, which just prints a final line and calls `::std::process::abort(1)`. I did it like this because if it just panics regularly, it looks like an ICE, an even though `html::render::run` returns a Result, that Result is also just `expect`ed immediately, generating the same problem. This way bypasses the panic handler at the top of the thread and looks like a proper failure. Since i don't have a real error Handler there, this is the best i can do without pulling in a real error system for rustdoc. This PR is blocked on #46853, which will fix the rendering differences that were present on master when i started this branch.
☀️ Test successful - status-appveyor, status-travis |
In the efforts of keeping the std docs free of markdown warnings, this PR adds a stopgap measure to make sure the CI fails if it detects a markdown difference. It does this by adding a new unstable flag to rustdoc,
--deny-render-differences
, which bootstrap then passes to rustdoc when documenting std and friends.The implementation is... probably not the cleanest option. It currently adds an extra branch after it prints the markdown warnings, which just prints a final line and calls
::std::process::abort(1)
. I did it like this because if it just panics regularly, it looks like an ICE, an even thoughhtml::render::run
returns a Result, that Result is also justexpect
ed immediately, generating the same problem. This way bypasses the panic handler at the top of the thread and looks like a proper failure. Since i don't have a real error Handler there, this is the best i can do without pulling in a real error system for rustdoc.This PR is blocked on #46853, which will fix the rendering differences that were present on master when i started this branch.