mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 06:35:27 +00:00
rustdoc: add option to abort process on markdown differences
This commit is contained in:
parent
eff3de0927
commit
e766f60c44
@ -495,7 +495,8 @@ pub fn run(mut krate: clean::Crate,
|
|||||||
css_file_extension: Option<PathBuf>,
|
css_file_extension: Option<PathBuf>,
|
||||||
renderinfo: RenderInfo,
|
renderinfo: RenderInfo,
|
||||||
render_type: RenderType,
|
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 {
|
let src_root = match krate.src {
|
||||||
FileName::Real(ref p) => match p.parent() {
|
FileName::Real(ref p) => match p.parent() {
|
||||||
Some(p) => p.to_path_buf(),
|
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);
|
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
|
result
|
||||||
|
@ -257,6 +257,10 @@ pub fn opts() -> Vec<RustcOptGroup> {
|
|||||||
o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the \
|
o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the \
|
||||||
program, rather than alphabetically")
|
program, rather than alphabetically")
|
||||||
}),
|
}),
|
||||||
|
unstable("deny-render-differences", |o| {
|
||||||
|
o.optflag("", "deny-render-differences", "abort doc runs when markdown rendering \
|
||||||
|
differences are found")
|
||||||
|
}),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,6 +397,7 @@ pub fn main_args(args: &[String]) -> isize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let output_format = matches.opt_str("w");
|
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 res = acquire_input(PathBuf::from(input), externs, &matches, move |out| {
|
||||||
let Output { krate, passes, renderinfo } = out;
|
let Output { krate, passes, renderinfo } = out;
|
||||||
info!("going to format");
|
info!("going to format");
|
||||||
@ -404,7 +409,8 @@ pub fn main_args(args: &[String]) -> isize {
|
|||||||
css_file_extension,
|
css_file_extension,
|
||||||
renderinfo,
|
renderinfo,
|
||||||
render_type,
|
render_type,
|
||||||
sort_modules_alphabetically)
|
sort_modules_alphabetically,
|
||||||
|
deny_render_differences)
|
||||||
.expect("failed to generate documentation");
|
.expect("failed to generate documentation");
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user