1
Fork 0

Point (again) to more expressions with their type, even if not fully resolved

This commit is contained in:
Esteban Kuber 2021-12-15 23:16:21 +00:00
parent c4d741fa16
commit 1c85987274
30 changed files with 125 additions and 31 deletions

View file

@ -602,7 +602,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
match *cause.code() {
ObligationCauseCode::Pattern { origin_expr: true, span: Some(span), root_ty } => {
let ty = self.resolve_vars_if_possible(root_ty);
if ty.is_suggestable() {
if !matches!(ty.kind(), ty::Infer(ty::InferTy::TyVar(_) | ty::InferTy::FreshTy(_)))
{
// don't show type `_`
err.span_label(span, format!("this expression has type `{}`", ty));
}