Auto merge of #46883 - QuietMisdreavus:faildown, r=GuillaumeGomez
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 https://github.com/rust-lang/rust/pull/46853, which will fix the rendering differences that were present on master when i started this branch.
This commit is contained in:
commit
966fdf15e2
3 changed files with 18 additions and 2 deletions
|
@ -495,7 +495,8 @@ pub fn run(mut krate: clean::Crate,
|
|||
css_file_extension: Option<PathBuf>,
|
||||
renderinfo: RenderInfo,
|
||||
render_type: RenderType,
|
||||
sort_modules_alphabetically: bool) -> Result<(), Error> {
|
||||
sort_modules_alphabetically: bool,
|
||||
deny_render_differences: bool) -> Result<(), Error> {
|
||||
let src_root = match krate.src {
|
||||
FileName::Real(ref p) => match p.parent() {
|
||||
Some(p) => p.to_path_buf(),
|
||||
|
@ -659,6 +660,11 @@ pub fn run(mut krate: clean::Crate,
|
|||
render_difference(d, &mut intro_msg, span, text);
|
||||
}
|
||||
}
|
||||
|
||||
if deny_render_differences {
|
||||
println!("Aborting with {} rendering differences", markdown_warnings.len());
|
||||
::std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue