diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 72131627aa5..d038890b908 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -351,7 +351,8 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> { method_types); } else if num_supplied_types != num_method_types { span_err!(self.tcx().sess, self.span, E0036, - "incorrect number of type parameters given for this method"); + "incorrect number of type parameters given for this method: expected {}, found {}", + num_method_types, num_supplied_types); final_substs.types.replace( subst::FnSpace, vec![self.tcx().types.err; num_method_types]); diff --git a/src/test/compile-fail/trait-test-2.rs b/src/test/compile-fail/trait-test-2.rs index 13fe314fbcd..73be7cf0dc0 100644 --- a/src/test/compile-fail/trait-test-2.rs +++ b/src/test/compile-fail/trait-test-2.rs @@ -16,7 +16,8 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } fn main() { 10.dup::(); //~ ERROR does not take type parameters - 10.blah::(); //~ ERROR incorrect number of type parameters + 10.blah::(); + //~^ ERROR incorrect number of type parameters given for this method: expected 1, found 2 (box 10 as Box).dup(); //~^ ERROR E0038 //~| ERROR E0038