Rename many DiagCtxt
and EarlyDiagCtxt
locals.
This commit is contained in:
parent
d58e372853
commit
f6aa418c9f
33 changed files with 250 additions and 258 deletions
|
@ -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);
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue