From 6a30ce639f9eeba7d085721d219553635f32c280 Mon Sep 17 00:00:00 2001 From: Dmitry Kadashev Date: Thu, 31 Oct 2019 16:57:29 +0700 Subject: [PATCH] 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` ``` --- src/librustc/ty/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 77613b548cfdb..4ef6a162c8b6f 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -241,7 +241,7 @@ impl<'tcx> ty::TyS<'tcx> { ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(), ty::Projection(_) => "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::Error => "type error".into(), }