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

@ -408,7 +408,7 @@ pub(crate) fn run_global_ctxt(
// Process all of the crate attributes, extracting plugin metadata along
// with the passes which we are supposed to run.
for attr in krate.module.attrs.lists(sym::doc) {
let diag = ctxt.sess().diagnostic();
let diag = ctxt.sess().dcx();
let name = attr.name_or_empty();
// `plugins = "..."`, `no_default_passes`, and `passes = "..."` have no effect
@ -448,7 +448,7 @@ pub(crate) fn run_global_ctxt(
tcx.sess.time("check_lint_expectations", || tcx.check_expectations(Some(sym::rustdoc)));
if tcx.sess.diagnostic().has_errors_or_lint_errors().is_some() {
if tcx.sess.dcx().has_errors_or_lint_errors().is_some() {
rustc_errors::FatalError.raise();
}

View file

@ -150,7 +150,7 @@ pub(crate) fn run(options: RustdocOptions) -> Result<(), ErrorGuaranteed> {
collector
});
if compiler.sess.diagnostic().has_errors_or_lint_errors().is_some() {
if compiler.sess.dcx().has_errors_or_lint_errors().is_some() {
FatalError.raise();
}

View file

@ -803,7 +803,7 @@ fn main_args(
compiler.enter(|queries| {
let mut gcx = abort_on_err(queries.global_ctxt(), sess);
if sess.diagnostic().has_errors_or_lint_errors().is_some() {
if sess.dcx().has_errors_or_lint_errors().is_some() {
sess.fatal("Compilation failed, aborting rustdoc");
}

View file

@ -22,7 +22,7 @@ pub(crate) fn collect_trait_impls(mut krate: Crate, cx: &mut DocContext<'_>) ->
let tcx = cx.tcx;
// We need to check if there are errors before running this pass because it would crash when
// we try to get auto and blanket implementations.
if tcx.sess.diagnostic().has_errors_or_lint_errors().is_some() {
if tcx.sess.dcx().has_errors_or_lint_errors().is_some() {
return krate;
}

View file

@ -311,7 +311,7 @@ pub(crate) fn run(
// The visitor might have found a type error, which we need to
// promote to a fatal error
if tcx.sess.diagnostic().has_errors_or_lint_errors().is_some() {
if tcx.sess.dcx().has_errors_or_lint_errors().is_some() {
return Err(String::from("Compilation failed, aborting rustdoc"));
}

View file

@ -163,7 +163,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
.iter()
.filter_map(|attr| {
Cfg::parse(attr.meta_item()?)
.map_err(|e| self.cx.sess().diagnostic().span_err(e.span, e.msg))
.map_err(|e| self.cx.sess().dcx().span_err(e.span, e.msg))
.ok()
})
.collect::<Vec<_>>()