1
Fork 0

Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1

This commit is contained in:
Gabriel Bustamante 2022-08-26 13:08:58 -05:00
parent fb888117da
commit 8e82200277
12 changed files with 180 additions and 87 deletions

View file

@ -1,6 +1,6 @@
use crate::errors::AutoDerefReachedRecursionLimit;
use crate::traits::query::evaluate_obligation::InferCtxtExt;
use crate::traits::{self, TraitEngine};
use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_infer::infer::InferCtxt;
use rustc_middle::ty::{self, TraitRef, Ty, TyCtxt};
@ -222,19 +222,10 @@ pub fn report_autoderef_recursion_limit_error<'tcx>(tcx: TyCtxt<'tcx>, span: Spa
Limit(0) => Limit(2),
limit => limit * 2,
};
struct_span_err!(
tcx.sess,
tcx.sess.emit_err(AutoDerefReachedRecursionLimit {
span,
E0055,
"reached the recursion limit while auto-dereferencing `{:?}`",
ty
)
.span_label(span, "deref recursion limit reached")
.help(&format!(
"consider increasing the recursion limit by adding a \
`#![recursion_limit = \"{}\"]` attribute to your crate (`{}`)",
ty,
suggested_limit,
tcx.crate_name(LOCAL_CRATE),
))
.emit();
crate_name: tcx.crate_name(LOCAL_CRATE),
});
}