1
Fork 0

Use Session::diagnostic in more places.

This commit is contained in:
Nicholas Nethercote 2023-12-01 13:35:19 +11:00
parent 6e9573936f
commit a179a53565
21 changed files with 51 additions and 66 deletions

View file

@ -148,7 +148,7 @@ where
let mut err = tcx.sess.create_err(err);
let msg = error.diagnostic_message();
error.add_args(&tcx.sess.parse_sess.span_diagnostic, &mut err);
error.add_args(tcx.sess.diagnostic(), &mut err);
// Use *our* span to label the interp error
err.span_label(our_span, msg);

View file

@ -437,7 +437,7 @@ pub trait ReportErrorExt {
{
ty::tls::with(move |tcx| {
let mut builder = tcx.sess.struct_allow(DiagnosticMessage::Str(String::new().into()));
let handler = &tcx.sess.parse_sess.span_diagnostic;
let handler = tcx.sess.diagnostic();
let message = self.diagnostic_message();
self.add_args(handler, &mut builder);
let s = handler.eagerly_translate_to_string(message, builder.args());

View file

@ -470,7 +470,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
backtrace.print_backtrace();
// FIXME(fee1-dead), HACK: we want to use the error as title therefore we can just extract the
// label and arguments from the InterpError.
let handler = &self.tcx.sess.parse_sess.span_diagnostic;
let handler = self.tcx.sess.diagnostic();
#[allow(rustc::untranslatable_diagnostic)]
let mut diag = self.tcx.sess.struct_allow("");
let msg = e.diagnostic_message();