From 052c482bbd87acc7ee824b6b8d2efb36c5b9917e Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Thu, 11 Jul 2013 15:08:31 -0700 Subject: [PATCH] Improve the error messages for mismatched numbers of type params. --- src/librustc/middle/typeck/check/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 5c8ce6b2d8bb..4caf0b62a546 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -3327,11 +3327,15 @@ pub fn instantiate_path(fcx: @mut FnCtxt, fcx.infcx().next_ty_vars(ty_param_count) } else if ty_substs_len > ty_param_count { fcx.ccx.tcx.sess.span_err - (span, "too many type parameters provided for this item"); + (span, + fmt!("too many type parameters provided: expected %u, found %u", + ty_param_count, ty_substs_len)); fcx.infcx().next_ty_vars(ty_param_count) } else if ty_substs_len < ty_param_count { fcx.ccx.tcx.sess.span_err - (span, "not enough type parameters provided for this item"); + (span, + fmt!("not enough type parameters provided: expected %u, found %u", + ty_param_count, ty_substs_len)); fcx.infcx().next_ty_vars(ty_param_count) } else { pth.types.map(|aty| fcx.to_ty(aty))