Add option to display warnings in rustdoc
This commit is contained in:
@@ -172,6 +172,7 @@ pub fn opts() -> Vec<RustcOptGroup> {
|
||||
or `#![doc(html_playground_url=...)]`",
|
||||
"URL")),
|
||||
unstable(optflag("", "enable-commonmark", "to enable commonmark doc rendering/testing")),
|
||||
unstable(optflag("", "display-warnings", "to print code warnings when testing doc")),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -279,14 +280,16 @@ pub fn main_args(args: &[String]) -> isize {
|
||||
let crate_name = matches.opt_str("crate-name");
|
||||
let playground_url = matches.opt_str("playground-url");
|
||||
let maybe_sysroot = matches.opt_str("sysroot").map(PathBuf::from);
|
||||
let display_warnings = matches.opt_present("display-warnings");
|
||||
|
||||
match (should_test, markdown_input) {
|
||||
(true, true) => {
|
||||
return markdown::test(input, cfgs, libs, externs, test_args, maybe_sysroot, render_type)
|
||||
return markdown::test(input, cfgs, libs, externs, test_args, maybe_sysroot, render_type,
|
||||
display_warnings)
|
||||
}
|
||||
(true, false) => {
|
||||
return test::run(input, cfgs, libs, externs, test_args, crate_name, maybe_sysroot,
|
||||
render_type)
|
||||
render_type, display_warnings)
|
||||
}
|
||||
(false, true) => return markdown::render(input,
|
||||
output.unwrap_or(PathBuf::from("doc")),
|
||||
@@ -388,13 +391,15 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
|
||||
|
||||
let cr = PathBuf::from(cratefile);
|
||||
info!("starting to run rustc");
|
||||
let display_warnings = matches.opt_present("display-warnings");
|
||||
|
||||
let (tx, rx) = channel();
|
||||
rustc_driver::monitor(move || {
|
||||
use rustc::session::config::Input;
|
||||
|
||||
let (mut krate, renderinfo) =
|
||||
core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot);
|
||||
core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot,
|
||||
display_warnings);
|
||||
|
||||
info!("finished with rustc");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user