rename is_tainted_by_errors
This commit is contained in:
parent
3fca95a597
commit
1c48039a87
13 changed files with 42 additions and 33 deletions
|
@ -2060,7 +2060,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
// check upstream for type errors and don't add the obligations to
|
||||
// begin with in those cases.
|
||||
if self.tcx.lang_items().sized_trait() == Some(trait_ref.def_id()) {
|
||||
if let None = self.is_tainted_by_errors() {
|
||||
if let None = self.tainted_by_errors() {
|
||||
self.emit_inference_failure_err(
|
||||
body_id,
|
||||
span,
|
||||
|
@ -2115,14 +2115,16 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
if impls.len() > 1 && impls.len() < 5 && has_non_region_infer {
|
||||
self.annotate_source_of_ambiguity(&mut err, &impls, predicate);
|
||||
} else {
|
||||
if self.is_tainted_by_errors().is_some() {
|
||||
if self.tainted_by_errors().is_some() {
|
||||
err.cancel();
|
||||
return;
|
||||
}
|
||||
err.note(&format!("cannot satisfy `{}`", predicate));
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
if self.is_tainted_by_errors().is_some() {
|
||||
if self.tainted_by_errors().is_some() {
|
||||
err.cancel();
|
||||
return;
|
||||
}
|
||||
err.note(&format!("cannot satisfy `{}`", predicate));
|
||||
|
@ -2224,7 +2226,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
] = path.segments
|
||||
&& data.trait_ref.def_id == *trait_id
|
||||
&& self.tcx.trait_of_item(*item_id) == Some(*trait_id)
|
||||
&& let None = self.is_tainted_by_errors()
|
||||
&& let None = self.tainted_by_errors()
|
||||
{
|
||||
let (verb, noun) = match self.tcx.associated_item(item_id).kind {
|
||||
ty::AssocKind::Const => ("refer to the", "constant"),
|
||||
|
@ -2293,7 +2295,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
// with error messages.
|
||||
if arg.references_error()
|
||||
|| self.tcx.sess.has_errors().is_some()
|
||||
|| self.is_tainted_by_errors().is_some()
|
||||
|| self.tainted_by_errors().is_some()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2304,7 +2306,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
ty::PredicateKind::Subtype(data) => {
|
||||
if data.references_error()
|
||||
|| self.tcx.sess.has_errors().is_some()
|
||||
|| self.is_tainted_by_errors().is_some()
|
||||
|| self.tainted_by_errors().is_some()
|
||||
{
|
||||
// no need to overload user in such cases
|
||||
return;
|
||||
|
@ -2315,7 +2317,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
self.emit_inference_failure_err(body_id, span, a.into(), ErrorCode::E0282, true)
|
||||
}
|
||||
ty::PredicateKind::Projection(data) => {
|
||||
if predicate.references_error() || self.is_tainted_by_errors().is_some() {
|
||||
if predicate.references_error() || self.tainted_by_errors().is_some() {
|
||||
return;
|
||||
}
|
||||
let subst = data
|
||||
|
@ -2349,7 +2351,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
}
|
||||
|
||||
ty::PredicateKind::ConstEvaluatable(data) => {
|
||||
if predicate.references_error() || self.is_tainted_by_errors().is_some() {
|
||||
if predicate.references_error() || self.tainted_by_errors().is_some() {
|
||||
return;
|
||||
}
|
||||
let subst = data.walk().find(|g| g.is_non_region_infer());
|
||||
|
@ -2376,7 +2378,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
}
|
||||
}
|
||||
_ => {
|
||||
if self.tcx.sess.has_errors().is_some() || self.is_tainted_by_errors().is_some() {
|
||||
if self.tcx.sess.has_errors().is_some() || self.tainted_by_errors().is_some() {
|
||||
return;
|
||||
}
|
||||
let mut err = struct_span_err!(
|
||||
|
@ -2420,7 +2422,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
post.sort();
|
||||
post.dedup();
|
||||
|
||||
if self.is_tainted_by_errors().is_some()
|
||||
if self.tainted_by_errors().is_some()
|
||||
&& (crate_names.len() == 1
|
||||
&& spans.len() == 0
|
||||
&& ["`core`", "`alloc`", "`std`"].contains(&crate_names[0].as_str())
|
||||
|
|
|
@ -1089,7 +1089,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
if !self.infcx.tcx.recursion_limit().value_within_limit(depth) {
|
||||
match self.query_mode {
|
||||
TraitQueryMode::Standard => {
|
||||
if let Some(e) = self.infcx.is_tainted_by_errors() {
|
||||
if let Some(e) = self.infcx.tainted_by_errors() {
|
||||
return Err(OverflowError::Error(e));
|
||||
}
|
||||
self.infcx.err_ctxt().report_overflow_error(error_obligation, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue