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_session | |
| parent | d58e372853a9e07a50f409c1e6f0fe8fe2f7c3ff (diff) | |
| download | rust-f6aa418c9f616ae898d01082f8fe324927295d9c.tar.gz rust-f6aa418c9f616ae898d01082f8fe324927295d9c.zip | |
Rename many `DiagCtxt` and `EarlyDiagCtxt` locals.
Diffstat (limited to 'compiler/rustc_session')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 8 |
3 files changed, 19 insertions, 12 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 1adb29fc583..0c21e4eb43e 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -2601,7 +2601,9 @@ fn parse_remap_path_prefix( .opt_strs("remap-path-prefix") .into_iter() .map(|remap| match remap.rsplit_once('=') { - None => early_dcx.early_error("--remap-path-prefix must contain '=' between FROM and TO"), + None => { + early_dcx.early_error("--remap-path-prefix must contain '=' between FROM and TO") + } Some((from, to)) => (PathBuf::from(from), PathBuf::from(to)), }) .collect(); @@ -2673,8 +2675,12 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M let output_types = parse_output_types(early_dcx, &unstable_opts, matches); let mut cg = CodegenOptions::build(early_dcx, matches); - let (disable_local_thinlto, mut codegen_units) = - should_override_cgus_and_disable_thinlto(early_dcx, &output_types, matches, cg.codegen_units); + let (disable_local_thinlto, mut codegen_units) = should_override_cgus_and_disable_thinlto( + early_dcx, + &output_types, + matches, + cg.codegen_units, + ); if unstable_opts.threads == 0 { early_dcx.early_error("value for threads must be a positive non-zero integer"); @@ -2851,7 +2857,8 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M } if cg.remark.is_empty() && unstable_opts.remark_dir.is_some() { - early_dcx.early_warn("using -Z remark-dir without enabling remarks using e.g. -C remark=all"); + early_dcx + .early_warn("using -Z remark-dir without enabling remarks using e.g. -C remark=all"); } let externs = parse_externs(early_dcx, matches, &unstable_opts); diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 377976e6188..2cb47e3a932 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -226,8 +226,8 @@ impl ParseSess { pub fn new(locale_resources: Vec<&'static str>, file_path_mapping: FilePathMapping) -> Self { let fallback_bundle = fallback_fluent_bundle(locale_resources, false); let sm = Lrc::new(SourceMap::new(file_path_mapping)); - let handler = DiagCtxt::with_tty_emitter(Some(sm.clone()), fallback_bundle); - ParseSess::with_dcx(handler, sm) + let dcx = DiagCtxt::with_tty_emitter(Some(sm.clone()), fallback_bundle); + ParseSess::with_dcx(dcx, sm) } pub fn with_dcx(dcx: DiagCtxt, source_map: Lrc<SourceMap>) -> Self { @@ -256,9 +256,9 @@ impl ParseSess { let fallback_bundle = fallback_fluent_bundle(Vec::new(), false); let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let fatal_dcx = DiagCtxt::with_tty_emitter(None, fallback_bundle).disable_warnings(); - let handler = DiagCtxt::with_emitter(Box::new(SilentEmitter { fatal_dcx, fatal_note })) + let dcx = DiagCtxt::with_emitter(Box::new(SilentEmitter { fatal_dcx, fatal_note })) .disable_warnings(); - ParseSess::with_dcx(handler, sm) + ParseSess::with_dcx(dcx, sm) } #[inline] diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 7f795e4bde4..7f168572f7d 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1416,10 +1416,10 @@ pub fn build_session( ); let emitter = default_emitter(&sopts, registry, source_map.clone(), bundle, fallback_bundle); - let mut span_diagnostic = DiagCtxt::with_emitter(emitter) + let mut dcx = DiagCtxt::with_emitter(emitter) .with_flags(sopts.unstable_opts.dcx_flags(can_emit_warnings)); if let Some(ice_file) = ice_file { - span_diagnostic = span_diagnostic.with_ice_file(ice_file); + dcx = dcx.with_ice_file(ice_file); } // Now that the proper handler has been constructed, drop early_dcx to @@ -1440,7 +1440,7 @@ pub fn build_session( match profiler { Ok(profiler) => Some(Arc::new(profiler)), Err(e) => { - span_diagnostic.emit_warning(errors::FailedToCreateProfiler { err: e.to_string() }); + dcx.emit_warning(errors::FailedToCreateProfiler { err: e.to_string() }); None } } @@ -1448,7 +1448,7 @@ pub fn build_session( None }; - let mut parse_sess = ParseSess::with_dcx(span_diagnostic, source_map); + let mut parse_sess = ParseSess::with_dcx(dcx, source_map); parse_sess.assume_incomplete_release = sopts.unstable_opts.assume_incomplete_release; let host_triple = config::host_triple(); |
