1
Fork 0

Combine individual limit queries into single limits query

This commit is contained in:
Aaron Hill 2021-07-04 13:02:51 -05:00
parent ff15b5e2c7
commit 7e5a88a56c
No known key found for this signature in database
GPG key ID: B4087E510E98B164
20 changed files with 75 additions and 55 deletions

View file

@ -53,7 +53,7 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
}
// If we have reached the recursion limit, error gracefully.
if !tcx.recursion_limit(()).value_within_limit(self.state.steps.len()) {
if !tcx.recursion_limit().value_within_limit(self.state.steps.len()) {
if !self.silence_errors {
report_autoderef_recursion_limit_error(tcx, self.span, self.state.cur_ty);
}
@ -217,7 +217,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
pub fn report_autoderef_recursion_limit_error<'tcx>(tcx: TyCtxt<'tcx>, span: Span, ty: Ty<'tcx>) {
// We've reached the recursion limit, error gracefully.
let suggested_limit = tcx.recursion_limit(()) * 2;
let suggested_limit = tcx.recursion_limit() * 2;
let msg = format!("reached the recursion limit while auto-dereferencing `{:?}`", ty);
let error_id = (DiagnosticMessageId::ErrorId(55), Some(span), msg);
let fresh = tcx.sess.one_time_diagnostics.borrow_mut().insert(error_id);