1
Fork 0

better error message for normalizes-to ambiguities

This commit is contained in:
Michael Goulet 2024-06-04 09:17:18 -04:00
parent 52b2c88bdf
commit b0c1474381
7 changed files with 26 additions and 10 deletions

View file

@ -2705,6 +2705,22 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
),
);
}
ty::PredicateKind::NormalizesTo(ty::NormalizesTo { alias, term })
if term.is_infer() =>
{
if let Some(e) = self.tainted_by_errors() {
return e;
}
struct_span_code_err!(
self.dcx(),
span,
E0284,
"type annotations needed: cannot normalize `{alias}`",
)
.with_span_label(span, format!("cannot normalize `{alias}`"))
}
_ => {
if let Some(e) = self.tainted_by_errors() {
return e;