Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ fn main() {
// This "unstable-options" can be removed when `--crate-version` is stabilized
cmd.arg("-Z").arg("unstable-options")
.arg("--crate-version").arg(version);

// While we can assume that `-Z unstable-options` is set, let's also force rustdoc to panic
// if pulldown rendering differences are found
cmd.arg("--deny-render-differences");
}

std::process::exit(match cmd.status() {
Expand Down
8 changes: 7 additions & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ pub fn opts() -> Vec<RustcOptGroup> {
o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the \
program, rather than alphabetically")
}),
unstable("deny-render-differences", |o| {
o.optflag("", "deny-render-differences", "abort doc runs when markdown rendering \
differences are found")
}),
]
}

Expand Down Expand Up @@ -393,6 +397,7 @@ pub fn main_args(args: &[String]) -> isize {
}

let output_format = matches.opt_str("w");
let deny_render_differences = matches.opt_present("deny-render-differences");
let res = acquire_input(PathBuf::from(input), externs, &matches, move |out| {
let Output { krate, passes, renderinfo } = out;
info!("going to format");
Expand All @@ -404,7 +409,8 @@ pub fn main_args(args: &[String]) -> isize {
css_file_extension,
renderinfo,
render_type,
sort_modules_alphabetically)
sort_modules_alphabetically,
deny_render_differences)
.expect("failed to generate documentation");
0
}
Expand Down