Rename Session::span_diagnostic as Session::dcx.

This commit is contained in:
Nicholas Nethercote 2023-12-18 06:21:26 +11:00
parent 9df1576e1d
commit 09af8a667c
66 changed files with 176 additions and 204 deletions

View file

@ -382,12 +382,12 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
codegen_backend.init(&sess);
let cfg = parse_cfg(&sess.diagnostic(), config.crate_cfg);
let cfg = parse_cfg(&sess.dcx(), config.crate_cfg);
let mut cfg = config::build_configuration(&sess, cfg);
util::add_configuration(&mut cfg, &mut sess, &*codegen_backend);
sess.parse_sess.config = cfg;
let mut check_cfg = parse_check_cfg(&sess.diagnostic(), config.crate_check_cfg);
let mut check_cfg = parse_check_cfg(&sess.dcx(), config.crate_check_cfg);
check_cfg.fill_well_known(&sess.target);
sess.parse_sess.check_config = check_cfg;

View file

@ -56,7 +56,7 @@ pub fn parse<'a>(sess: &'a Session) -> PResult<'a, ast::Crate> {
}
if let Some(ref s) = sess.opts.unstable_opts.show_span {
rustc_ast_passes::show_span::run(sess.diagnostic(), s, &krate);
rustc_ast_passes::show_span::run(sess.dcx(), s, &krate);
}
if sess.opts.unstable_opts.hir_stats {
@ -267,7 +267,7 @@ fn configure_and_expand(
is_proc_macro_crate,
has_proc_macro_decls,
is_test_crate,
sess.diagnostic(),
sess.dcx(),
)
});
@ -526,7 +526,7 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
match result {
Ok(_) => {
if sess.opts.json_artifact_notifications {
sess.diagnostic().emit_artifact_notification(deps_filename, "dep-info");
sess.dcx().emit_artifact_notification(deps_filename, "dep-info");
}
}
Err(error) => {

View file

@ -228,7 +228,7 @@ impl<'tcx> Queries<'tcx> {
// If we have any delayed bugs, for example because we created TyKind::Error earlier,
// it's likely that codegen will only cause more ICEs, obscuring the original problem
self.compiler.sess.diagnostic().flush_delayed();
self.compiler.sess.dcx().flush_delayed();
// Hook for UI tests.
Self::check_for_rustc_errors_attr(tcx);

View file

@ -52,7 +52,7 @@ fn mk_session(matches: getopts::Matches) -> (Session, Cfg) {
Arc::default(),
Default::default(),
);
let cfg = parse_cfg(&sess.diagnostic(), matches.opt_strs("cfg"));
let cfg = parse_cfg(&sess.dcx(), matches.opt_strs("cfg"));
(sess, cfg)
}
@ -143,20 +143,20 @@ fn test_can_print_warnings() {
rustc_span::create_default_session_globals_then(|| {
let matches = optgroups().parse(&["-Awarnings".to_string()]).unwrap();
let (sess, _) = mk_session(matches);
assert!(!sess.diagnostic().can_emit_warnings());
assert!(!sess.dcx().can_emit_warnings());
});
rustc_span::create_default_session_globals_then(|| {
let matches =
optgroups().parse(&["-Awarnings".to_string(), "-Dwarnings".to_string()]).unwrap();
let (sess, _) = mk_session(matches);
assert!(sess.diagnostic().can_emit_warnings());
assert!(sess.dcx().can_emit_warnings());
});
rustc_span::create_default_session_globals_then(|| {
let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap();
let (sess, _) = mk_session(matches);
assert!(sess.diagnostic().can_emit_warnings());
assert!(sess.dcx().can_emit_warnings());
});
}