Use translatable diagnostics in rustc_const_eval

This commit is contained in:
Deadbeef 2023-05-17 10:30:14 +00:00
parent 642c92e630
commit 4f83717cf7
93 changed files with 2375 additions and 1123 deletions

View file

@ -73,17 +73,8 @@ pub(crate) fn eval_to_valtree<'tcx>(
let global_const_id = cid.display(tcx);
match err {
ValTreeCreationError::NodesOverflow => {
let msg = format!(
"maximum number of nodes exceeded in constant {}",
&global_const_id
);
let mut diag = match tcx.hir().span_if_local(did) {
Some(span) => {
tcx.sess.create_err(MaxNumNodesInConstErr { span, global_const_id })
}
None => tcx.sess.struct_err(msg),
};
diag.emit();
let span = tcx.hir().span_if_local(did);
tcx.sess.emit_err(MaxNumNodesInConstErr { span, global_const_id });
Ok(None)
}