diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 11:15:13 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 16:06:22 +1100 |
| commit | f6aa418c9f616ae898d01082f8fe324927295d9c (patch) | |
| tree | 555aa9010c2e7a5721413bc0c6da3301280c588b /compiler/rustc_interface/src | |
| parent | d58e372853a9e07a50f409c1e6f0fe8fe2f7c3ff (diff) | |
| download | rust-f6aa418c9f616ae898d01082f8fe324927295d9c.tar.gz rust-f6aa418c9f616ae898d01082f8fe324927295d9c.zip | |
Rename many `DiagCtxt` and `EarlyDiagCtxt` locals.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/tests.rs | 60 |
2 files changed, 36 insertions, 36 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index d86c5e91c47..d58d60fc8be 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -315,8 +315,8 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se rustc_data_structures::sync::set_dyn_thread_safe_mode(config.opts.unstable_opts.threads > 1); // Check jobserver before run_in_thread_pool_with_globals, which call jobserver::acquire_thread - let early_handler = EarlyDiagCtxt::new(config.opts.error_format); - early_handler.initialize_checked_jobserver(); + let early_dcx = EarlyDiagCtxt::new(config.opts.error_format); + early_dcx.initialize_checked_jobserver(); util::run_in_thread_pool_with_globals( config.opts.edition, @@ -324,13 +324,13 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se || { crate::callbacks::setup_callbacks(); - let early_handler = EarlyDiagCtxt::new(config.opts.error_format); + let early_dcx = EarlyDiagCtxt::new(config.opts.error_format); let codegen_backend = if let Some(make_codegen_backend) = config.make_codegen_backend { make_codegen_backend(&config.opts) } else { util::get_codegen_backend( - &early_handler, + &early_dcx, &config.opts.maybe_sysroot, config.opts.unstable_opts.codegen_backend.as_deref(), ) @@ -347,7 +347,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se ) { Ok(bundle) => bundle, Err(e) => { - early_handler.early_error(format!("failed to load fluent bundle: {e}")); + early_dcx.early_error(format!("failed to load fluent bundle: {e}")); } }; @@ -358,7 +358,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se let target_override = codegen_backend.target_override(&config.opts); let mut sess = rustc_session::build_session( - early_handler, + early_dcx, config.opts, CompilerIO { input: config.input, diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 12547799db8..04a7714d413 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -25,11 +25,11 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; fn mk_session(matches: getopts::Matches) -> (Session, Cfg) { - let mut early_handler = EarlyDiagCtxt::new(ErrorOutputType::default()); - early_handler.initialize_checked_jobserver(); + let mut early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default()); + early_dcx.initialize_checked_jobserver(); let registry = registry::Registry::new(&[]); - let sessopts = build_session_options(&mut early_handler, &matches); + let sessopts = build_session_options(&mut early_dcx, &matches); let temps_dir = sessopts.unstable_opts.temps_dir.as_deref().map(PathBuf::from); let io = CompilerIO { input: Input::Str { name: FileName::Custom(String::new()), input: String::new() }, @@ -38,7 +38,7 @@ fn mk_session(matches: getopts::Matches) -> (Session, Cfg) { temps_dir, }; let sess = build_session( - early_handler, + early_dcx, sessopts, io, None, @@ -301,36 +301,36 @@ fn test_search_paths_tracking_hash_different_order() { let mut v3 = Options::default(); let mut v4 = Options::default(); - let handler = EarlyDiagCtxt::new(JSON); + let early_dcx = EarlyDiagCtxt::new(JSON); const JSON: ErrorOutputType = ErrorOutputType::Json { pretty: false, json_rendered: HumanReadableErrorType::Default(ColorConfig::Never), }; // Reference - v1.search_paths.push(SearchPath::from_cli_opt(&handler, "native=abc")); - v1.search_paths.push(SearchPath::from_cli_opt(&handler, "crate=def")); - v1.search_paths.push(SearchPath::from_cli_opt(&handler, "dependency=ghi")); - v1.search_paths.push(SearchPath::from_cli_opt(&handler, "framework=jkl")); - v1.search_paths.push(SearchPath::from_cli_opt(&handler, "all=mno")); - - v2.search_paths.push(SearchPath::from_cli_opt(&handler, "native=abc")); - v2.search_paths.push(SearchPath::from_cli_opt(&handler, "dependency=ghi")); - v2.search_paths.push(SearchPath::from_cli_opt(&handler, "crate=def")); - v2.search_paths.push(SearchPath::from_cli_opt(&handler, "framework=jkl")); - v2.search_paths.push(SearchPath::from_cli_opt(&handler, "all=mno")); - - v3.search_paths.push(SearchPath::from_cli_opt(&handler, "crate=def")); - v3.search_paths.push(SearchPath::from_cli_opt(&handler, "framework=jkl")); - v3.search_paths.push(SearchPath::from_cli_opt(&handler, "native=abc")); - v3.search_paths.push(SearchPath::from_cli_opt(&handler, "dependency=ghi")); - v3.search_paths.push(SearchPath::from_cli_opt(&handler, "all=mno")); - - v4.search_paths.push(SearchPath::from_cli_opt(&handler, "all=mno")); - v4.search_paths.push(SearchPath::from_cli_opt(&handler, "native=abc")); - v4.search_paths.push(SearchPath::from_cli_opt(&handler, "crate=def")); - v4.search_paths.push(SearchPath::from_cli_opt(&handler, "dependency=ghi")); - v4.search_paths.push(SearchPath::from_cli_opt(&handler, "framework=jkl")); + v1.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "native=abc")); + v1.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "crate=def")); + v1.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "dependency=ghi")); + v1.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "framework=jkl")); + v1.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "all=mno")); + + v2.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "native=abc")); + v2.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "dependency=ghi")); + v2.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "crate=def")); + v2.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "framework=jkl")); + v2.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "all=mno")); + + v3.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "crate=def")); + v3.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "framework=jkl")); + v3.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "native=abc")); + v3.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "dependency=ghi")); + v3.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "all=mno")); + + v4.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "all=mno")); + v4.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "native=abc")); + v4.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "crate=def")); + v4.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "dependency=ghi")); + v4.search_paths.push(SearchPath::from_cli_opt(&early_dcx, "framework=jkl")); assert_same_hash(&v1, &v2); assert_same_hash(&v1, &v3); @@ -854,9 +854,9 @@ fn test_edition_parsing() { let options = Options::default(); assert!(options.edition == DEFAULT_EDITION); - let mut handler = EarlyDiagCtxt::new(ErrorOutputType::default()); + let mut early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default()); let matches = optgroups().parse(&["--edition=2018".to_string()]).unwrap(); - let sessopts = build_session_options(&mut handler, &matches); + let sessopts = build_session_options(&mut early_dcx, &matches); assert!(sessopts.edition == Edition::Edition2018) } |
