Add type parameter name to type mismatch error messages

Part of #47319.

This just adds type parameter name to type mismatch error message, so
e.g. the following:

```
expected enum `std::option::Option`, found type parameter
```

becomes

```
expected enum `std::option::Option`, found type parameter `T`
```
This commit is contained in:
Dmitry Kadashev 2019-10-31 16:57:29 +07:00
parent 87cbf0a547
commit 6a30ce639f

View file

@ -241,7 +241,7 @@ impl<'tcx> ty::TyS<'tcx> {
ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(), ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(),
ty::Projection(_) => "associated type".into(), ty::Projection(_) => "associated type".into(),
ty::UnnormalizedProjection(_) => "non-normalized associated type".into(), ty::UnnormalizedProjection(_) => "non-normalized associated type".into(),
ty::Param(_) => "type parameter".into(), ty::Param(p) => format!("type parameter `{}`", p).into(),
ty::Opaque(..) => "opaque type".into(), ty::Opaque(..) => "opaque type".into(),
ty::Error => "type error".into(), ty::Error => "type error".into(),
} }