Add checks & fallback branch
This commit is contained in:
parent
82ab171673
commit
b33955a0ef
1 changed files with 13 additions and 1 deletions
|
@ -2157,6 +2157,9 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::PredicateKind::ConstEvaluatable(data) => {
|
ty::PredicateKind::ConstEvaluatable(data) => {
|
||||||
|
if predicate.references_error() || self.is_tainted_by_errors() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let subst = data.substs.iter().find(|g| g.has_infer_types_or_consts());
|
let subst = data.substs.iter().find(|g| g.has_infer_types_or_consts());
|
||||||
if let Some(subst) = subst {
|
if let Some(subst) = subst {
|
||||||
let mut err = self.emit_inference_failure_err(
|
let mut err = self.emit_inference_failure_err(
|
||||||
|
@ -2169,7 +2172,16 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
err.note(&format!("cannot satisfy `{}`", predicate));
|
err.note(&format!("cannot satisfy `{}`", predicate));
|
||||||
err
|
err
|
||||||
} else {
|
} else {
|
||||||
todo!();
|
// If we can't find a substitution, just print a generic error
|
||||||
|
let mut err = struct_span_err!(
|
||||||
|
self.tcx.sess,
|
||||||
|
span,
|
||||||
|
E0284,
|
||||||
|
"type annotations needed: cannot satisfy `{}`",
|
||||||
|
predicate,
|
||||||
|
);
|
||||||
|
err.span_label(span, &format!("cannot satisfy `{}`", predicate));
|
||||||
|
err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue