1
Fork 0

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

@ -324,11 +324,11 @@ pub fn struct_lint_level(
(Level::Warn | Level::ForceWarn(None), Some(span)) => sess.struct_span_warn(span, ""),
(Level::Warn | Level::ForceWarn(None), None) => sess.struct_warn(""),
(Level::Deny | Level::Forbid, Some(span)) => {
let mut builder = sess.diagnostic().struct_err_lint("");
let mut builder = sess.dcx().struct_err_lint("");
builder.set_span(span);
builder
}
(Level::Deny | Level::Forbid, None) => sess.diagnostic().struct_err_lint(""),
(Level::Deny | Level::Forbid, None) => sess.dcx().struct_err_lint(""),
};
err.set_is_lint();

View file

@ -1484,7 +1484,7 @@ impl<'tcx> OpaqueHiddenType<'tcx> {
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
if let Some(diag) = tcx
.sess
.diagnostic()
.dcx()
.steal_diagnostic(tcx.def_span(opaque_def_id), StashKey::OpaqueHiddenTypeMismatch)
{
diag.cancel();

View file

@ -31,8 +31,8 @@ fn opt_span_bug_fmt<S: Into<MultiSpan>>(
tls::with_opt(move |tcx| {
let msg = format!("{location}: {args}");
match (tcx, span) {
(Some(tcx), Some(span)) => tcx.sess.diagnostic().span_bug(span, msg),
(Some(tcx), None) => tcx.sess.diagnostic().bug(msg),
(Some(tcx), Some(span)) => tcx.sess.dcx().span_bug(span, msg),
(Some(tcx), None) => tcx.sess.dcx().bug(msg),
(None, _) => panic_any(msg),
}
})