1
Fork 0

Avoid noting cause code (which is usually misc, b/c codegen) for opaque type reveal overflow

This commit is contained in:
Michael Goulet 2022-12-06 00:19:42 +00:00
parent e940f845be
commit d2a80c1571
6 changed files with 82 additions and 51 deletions

View file

@ -7,7 +7,7 @@ use crate::infer::canonical::OriginalQueryValues;
use crate::infer::{InferCtxt, InferOk};
use crate::traits::error_reporting::TypeErrCtxtExt;
use crate::traits::project::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};
use crate::traits::{Obligation, ObligationCause, PredicateObligation, Reveal};
use crate::traits::{ObligationCause, PredicateObligation, Reveal};
use rustc_data_structures::sso::SsoHashMap;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_infer::traits::Normalized;
@ -214,14 +214,12 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
let substs = substs.try_fold_with(self)?;
let recursion_limit = self.tcx().recursion_limit();
if !recursion_limit.value_within_limit(self.anon_depth) {
let obligation = Obligation::with_depth(
self.tcx(),
self.cause.clone(),
recursion_limit.0,
self.param_env,
ty,
self.infcx.err_ctxt().report_overflow_error(
&ty,
self.cause.span,
true,
|_| {},
);
self.infcx.err_ctxt().report_overflow_error(&obligation, true);
}
let generic_ty = self.tcx().bound_type_of(def_id);