Rollup merge of #54371 - QuietMisdreavus:rustdoc-ui-testing, r=GuillaumeGomez
add -Zui-testing to rustdoc Before we depend on the `rustdoc-ui` tests some more, let's make rustdoc act the same as the compiler when they're actually being executed.
This commit is contained in:
commit
7248b79082
6 changed files with 48 additions and 37 deletions
|
|
@ -272,6 +272,7 @@ impl DocAccessLevels for AccessLevels<DefId> {
|
|||
pub fn new_handler(error_format: ErrorOutputType,
|
||||
source_map: Option<Lrc<source_map::SourceMap>>,
|
||||
treat_err_as_bug: bool,
|
||||
ui_testing: bool,
|
||||
) -> errors::Handler {
|
||||
// rustdoc doesn't override (or allow to override) anything from this that is relevant here, so
|
||||
// stick to the defaults
|
||||
|
|
@ -283,7 +284,7 @@ pub fn new_handler(error_format: ErrorOutputType,
|
|||
source_map.map(|cm| cm as _),
|
||||
false,
|
||||
sessopts.debugging_opts.teach,
|
||||
).ui_testing(sessopts.debugging_opts.ui_testing)
|
||||
).ui_testing(ui_testing)
|
||||
),
|
||||
ErrorOutputType::Json(pretty) => {
|
||||
let source_map = source_map.unwrap_or_else(
|
||||
|
|
@ -293,7 +294,7 @@ pub fn new_handler(error_format: ErrorOutputType,
|
|||
None,
|
||||
source_map,
|
||||
pretty,
|
||||
).ui_testing(sessopts.debugging_opts.ui_testing)
|
||||
).ui_testing(ui_testing)
|
||||
)
|
||||
},
|
||||
ErrorOutputType::Short(color_config) => Box::new(
|
||||
|
|
@ -335,6 +336,7 @@ pub fn run_core(search_paths: SearchPaths,
|
|||
mut manual_passes: Vec<String>,
|
||||
mut default_passes: passes::DefaultPassOption,
|
||||
treat_err_as_bug: bool,
|
||||
ui_testing: bool,
|
||||
) -> (clean::Crate, RenderInfo, Vec<String>) {
|
||||
// Parse, resolve, and typecheck the given crate.
|
||||
|
||||
|
|
@ -389,6 +391,8 @@ pub fn run_core(search_paths: SearchPaths,
|
|||
actually_rustdoc: true,
|
||||
debugging_opts: config::DebuggingOptions {
|
||||
force_unstable_if_unmarked,
|
||||
treat_err_as_bug,
|
||||
ui_testing,
|
||||
..config::basic_debugging_options()
|
||||
},
|
||||
error_format,
|
||||
|
|
@ -400,7 +404,8 @@ pub fn run_core(search_paths: SearchPaths,
|
|||
let source_map = Lrc::new(source_map::SourceMap::new(sessopts.file_path_mapping()));
|
||||
let diagnostic_handler = new_handler(error_format,
|
||||
Some(source_map.clone()),
|
||||
treat_err_as_bug);
|
||||
treat_err_as_bug,
|
||||
ui_testing);
|
||||
|
||||
let mut sess = session::build_session_(
|
||||
sessopts, cpath, diagnostic_handler, source_map,
|
||||
|
|
|
|||
|
|
@ -409,8 +409,11 @@ fn main_args(args: &[String]) -> isize {
|
|||
let treat_err_as_bug = matches.opt_strs("Z").iter().any(|x| {
|
||||
*x == "treat-err-as-bug"
|
||||
});
|
||||
let ui_testing = matches.opt_strs("Z").iter().any(|x| {
|
||||
*x == "ui-testing"
|
||||
});
|
||||
|
||||
let diag = core::new_handler(error_format, None, treat_err_as_bug);
|
||||
let diag = core::new_handler(error_format, None, treat_err_as_bug, ui_testing);
|
||||
|
||||
// check for deprecated options
|
||||
check_deprecated_options(&matches, &diag);
|
||||
|
|
@ -565,7 +568,7 @@ fn main_args(args: &[String]) -> isize {
|
|||
let res = acquire_input(PathBuf::from(input), externs, edition, cg, &matches, error_format,
|
||||
move |out| {
|
||||
let Output { krate, passes, renderinfo } = out;
|
||||
let diag = core::new_handler(error_format, None, treat_err_as_bug);
|
||||
let diag = core::new_handler(error_format, None, treat_err_as_bug, ui_testing);
|
||||
info!("going to format");
|
||||
match output_format.as_ref().map(|s| &**s) {
|
||||
Some("html") | None => {
|
||||
|
|
@ -702,6 +705,9 @@ where R: 'static + Send,
|
|||
let treat_err_as_bug = matches.opt_strs("Z").iter().any(|x| {
|
||||
*x == "treat-err-as-bug"
|
||||
});
|
||||
let ui_testing = matches.opt_strs("Z").iter().any(|x| {
|
||||
*x == "ui-testing"
|
||||
});
|
||||
|
||||
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
|
||||
|
||||
|
|
@ -715,7 +721,7 @@ where R: 'static + Send,
|
|||
display_warnings, crate_name.clone(),
|
||||
force_unstable_if_unmarked, edition, cg, error_format,
|
||||
lint_opts, lint_cap, describe_lints, manual_passes, default_passes,
|
||||
treat_err_as_bug);
|
||||
treat_err_as_bug, ui_testing);
|
||||
|
||||
info!("finished with rustc");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue