1
Fork 0

do not use <: in subtyping overflow msg

This commit is contained in:
lcnr 2024-01-15 15:31:30 +01:00
parent f7cdff825c
commit 49dc0f22f4
15 changed files with 35 additions and 22 deletions

View file

@ -239,13 +239,26 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
}
OverflowCause::TraitSolver(predicate) => {
let predicate = self.resolve_vars_if_possible(predicate);
let pred_str = with_short_path(self.tcx, predicate);
struct_span_code_err!(
self.dcx(),
span,
E0275,
"overflow evaluating the requirement `{pred_str}`",
)
match predicate.kind().skip_binder() {
ty::PredicateKind::Subtype(ty::SubtypePredicate { a, b, a_is_expected: _ })
| ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) => {
struct_span_code_err!(
self.dcx(),
span,
E0275,
"overflow setting `{a}` to a subtype of `{b}`",
)
}
_ => {
let pred_str = with_short_path(self.tcx, predicate);
struct_span_code_err!(
self.dcx(),
span,
E0275,
"overflow evaluating the requirement `{pred_str}`",
)
}
}
}
};