Skip to content

Commit fcd93ac

Browse files
committed
Use translatable diagnostics in rustc_const_eval
1 parent 04dca8f commit fcd93ac

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/common.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rustc_index::IndexVec;
66
use rustc_middle::ty::layout::{
77
FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers,
88
};
9+
use rustc_span::source_map::Spanned;
910
use rustc_span::SourceFile;
1011
use rustc_target::abi::call::FnAbi;
1112
use rustc_target::abi::{Integer, Primitive};
@@ -495,25 +496,16 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> {
495496
fn_abi_request: FnAbiRequest<'tcx>,
496497
) -> ! {
497498
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
498-
self.0.sess.span_fatal(span, err.to_string())
499+
self.0.sess.emit_fatal(Spanned { span, node: err })
499500
} else {
500501
match fn_abi_request {
501502
FnAbiRequest::OfFnPtr { sig, extra_args } => {
502-
span_bug!(
503-
span,
504-
"`fn_abi_of_fn_ptr({}, {:?})` failed: {}",
505-
sig,
506-
extra_args,
507-
err
508-
);
503+
span_bug!(span, "`fn_abi_of_fn_ptr({sig}, {extra_args:?})` failed: {err:?}");
509504
}
510505
FnAbiRequest::OfInstance { instance, extra_args } => {
511506
span_bug!(
512507
span,
513-
"`fn_abi_of_instance({}, {:?})` failed: {}",
514-
instance,
515-
extra_args,
516-
err
508+
"`fn_abi_of_instance({instance}, {extra_args:?})` failed: {err:?}"
517509
);
518510
}
519511
}

0 commit comments

Comments
 (0)