diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 10:57:26 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 16:06:22 +1100 |
| commit | d58e372853a9e07a50f409c1e6f0fe8fe2f7c3ff (patch) | |
| tree | 2487904a6611125e2ae9263ffc983b3c86497c6e /src | |
| parent | f422dca3ae8b8a8c9a99b8e6ec0899e08dc072c3 (diff) | |
| download | rust-d58e372853a9e07a50f409c1e6f0fe8fe2f7c3ff.tar.gz rust-d58e372853a9e07a50f409c1e6f0fe8fe2f7c3ff.zip | |
Rename many `EarlyDiagCtxt` arguments.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/config.rs | 30 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 18 | ||||
| -rw-r--r-- | src/tools/miri/src/bin/miri.rs | 8 |
3 files changed, 28 insertions, 28 deletions
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 47bb2d883e3..e59a0192afc 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -320,33 +320,33 @@ impl Options { /// Parses the given command-line for options. If an error message or other early-return has /// been printed, returns `Err` with the exit code. pub(crate) fn from_matches( - handler: &mut EarlyDiagCtxt, + early_dcx: &mut EarlyDiagCtxt, matches: &getopts::Matches, args: Vec<String>, ) -> Result<(Options, RenderOptions), i32> { // Check for unstable options. - nightly_options::check_nightly_options(handler, matches, &opts()); + nightly_options::check_nightly_options(early_dcx, matches, &opts()); if args.is_empty() || matches.opt_present("h") || matches.opt_present("help") { crate::usage("rustdoc"); return Err(0); } else if matches.opt_present("version") { - rustc_driver::version!(&handler, "rustdoc", matches); + rustc_driver::version!(&early_dcx, "rustdoc", matches); return Err(0); } - if rustc_driver::describe_flag_categories(handler, &matches) { + if rustc_driver::describe_flag_categories(early_dcx, &matches) { return Err(0); } - let color = config::parse_color(handler, matches); + let color = config::parse_color(early_dcx, matches); let config::JsonConfig { json_rendered, json_unused_externs, .. } = - config::parse_json(handler, matches); - let error_format = config::parse_error_format(handler, matches, color, json_rendered); + config::parse_json(early_dcx, matches); + let error_format = config::parse_error_format(early_dcx, matches, color, json_rendered); let diagnostic_width = matches.opt_get("diagnostic-width").unwrap_or_default(); - let codegen_options = CodegenOptions::build(handler, matches); - let unstable_opts = UnstableOptions::build(handler, matches); + let codegen_options = CodegenOptions::build(early_dcx, matches); + let unstable_opts = UnstableOptions::build(early_dcx, matches); let diag = new_dcx(error_format, None, diagnostic_width, &unstable_opts); @@ -403,7 +403,7 @@ impl Options { && !matches.opt_present("show-coverage") && !nightly_options::is_unstable_enabled(matches) { - handler.early_error( + early_dcx.early_error( "the -Z unstable-options flag must be passed to enable --output-format for documentation generation (see https://github.com/rust-lang/rust/issues/76578)", ); } @@ -447,7 +447,7 @@ impl Options { return Err(0); } - let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(handler, matches); + let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(early_dcx, matches); let input = PathBuf::from(if describe_lints { "" // dummy, this won't be used @@ -462,8 +462,8 @@ impl Options { }); let libs = - matches.opt_strs("L").iter().map(|s| SearchPath::from_cli_opt(handler, s)).collect(); - let externs = parse_externs(handler, matches, &unstable_opts); + matches.opt_strs("L").iter().map(|s| SearchPath::from_cli_opt(early_dcx, s)).collect(); + let externs = parse_externs(early_dcx, matches, &unstable_opts); let extern_html_root_urls = match parse_extern_html_roots(matches) { Ok(ex) => ex, Err(err) => { @@ -605,7 +605,7 @@ impl Options { } } - let edition = config::parse_crate_edition(handler, matches); + let edition = config::parse_crate_edition(early_dcx, matches); let mut id_map = html::markdown::IdMap::new(); let Some(external_html) = ExternalHtml::load( @@ -639,7 +639,7 @@ impl Options { } } - let target = parse_target_triple(handler, matches); + let target = parse_target_triple(early_dcx, matches); let show_coverage = matches.opt_present("show-coverage"); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 02f608a515b..378a93e47c6 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -189,15 +189,15 @@ pub fn main() { process::exit(exit_code); } -fn init_logging(handler: &EarlyDiagCtxt) { +fn init_logging(early_dcx: &EarlyDiagCtxt) { let color_logs = match std::env::var("RUSTDOC_LOG_COLOR").as_deref() { Ok("always") => true, Ok("never") => false, Ok("auto") | Err(VarError::NotPresent) => io::stdout().is_terminal(), - Ok(value) => handler.early_error(format!( + Ok(value) => early_dcx.early_error(format!( "invalid log color value '{value}': expected one of always, never, or auto", )), - Err(VarError::NotUnicode(value)) => handler.early_error(format!( + Err(VarError::NotUnicode(value)) => early_dcx.early_error(format!( "invalid log color value '{}': expected one of always, never, or auto", value.to_string_lossy() )), @@ -220,13 +220,13 @@ fn init_logging(handler: &EarlyDiagCtxt) { tracing::subscriber::set_global_default(subscriber).unwrap(); } -fn get_args(handler: &EarlyDiagCtxt) -> Option<Vec<String>> { +fn get_args(early_dcx: &EarlyDiagCtxt) -> Option<Vec<String>> { env::args_os() .enumerate() .map(|(i, arg)| { arg.into_string() .map_err(|arg| { - handler.early_warn(format!("Argument {i} is not valid Unicode: {arg:?}")); + early_dcx.early_warn(format!("Argument {i} is not valid Unicode: {arg:?}")); }) .ok() }) @@ -704,7 +704,7 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>( } fn main_args( - handler: &mut EarlyDiagCtxt, + early_dcx: &mut EarlyDiagCtxt, at_args: &[String], using_internal_features: Arc<AtomicBool>, ) -> MainResult { @@ -718,7 +718,7 @@ fn main_args( // the compiler with @empty_file as argv[0] and no more arguments. let at_args = at_args.get(1..).unwrap_or_default(); - let args = rustc_driver::args::arg_expand_all(handler, at_args); + let args = rustc_driver::args::arg_expand_all(early_dcx, at_args); let mut options = getopts::Options::new(); for option in opts() { @@ -727,13 +727,13 @@ fn main_args( let matches = match options.parse(&args) { Ok(m) => m, Err(err) => { - handler.early_error(err.to_string()); + early_dcx.early_error(err.to_string()); } }; // Note that we discard any distinction between different non-zero exit // codes from `from_matches` here. - let (options, render_options) = match config::Options::from_matches(handler, &matches, args) { + let (options, render_options) = match config::Options::from_matches(early_dcx, &matches, args) { Ok(opts) => opts, Err(code) => { return if code == 0 { diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index c1ae6f070c5..c328133f6cd 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -215,7 +215,7 @@ fn rustc_logger_config() -> rustc_log::LoggerConfig { cfg } -fn init_early_loggers(handler: &EarlyDiagCtxt) { +fn init_early_loggers(early_dcx: &EarlyDiagCtxt) { // Note that our `extern crate log` is *not* the same as rustc's; as a result, we have to // initialize them both, and we always initialize `miri`'s first. let env = env_logger::Env::new().filter("MIRI_LOG").write_style("MIRI_LOG_STYLE"); @@ -224,15 +224,15 @@ fn init_early_loggers(handler: &EarlyDiagCtxt) { // If it is not set, we avoid initializing now so that we can initialize later with our custom // settings, and *not* log anything for what happens before `miri` gets started. if env::var_os("RUSTC_LOG").is_some() { - rustc_driver::init_logger(handler, rustc_logger_config()); + rustc_driver::init_logger(early_dcx, rustc_logger_config()); } } -fn init_late_loggers(handler: &EarlyDiagCtxt, tcx: TyCtxt<'_>) { +fn init_late_loggers(early_dcx: &EarlyDiagCtxt, tcx: TyCtxt<'_>) { // If `RUSTC_LOG` is not set, then `init_early_loggers` did not call // `rustc_driver::init_logger`, so we have to do this now. if env::var_os("RUSTC_LOG").is_none() { - rustc_driver::init_logger(handler, rustc_logger_config()); + rustc_driver::init_logger(early_dcx, rustc_logger_config()); } // If `MIRI_BACKTRACE` is set and `RUSTC_CTFE_BACKTRACE` is not, set `RUSTC_CTFE_BACKTRACE`. |
