Skip to content

Commit 05b66b8

Browse files
committed
Auto merge of #29705 - Ryman:mismatched_typaram_counts, r=alexcrichton
…type-params for methods
2 parents e9aa32a + 8bad031 commit 05b66b8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/librustc_typeck/check/method/confirm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
351351
method_types);
352352
} else if num_supplied_types != num_method_types {
353353
span_err!(self.tcx().sess, self.span, E0036,
354-
"incorrect number of type parameters given for this method");
354+
"incorrect number of type parameters given for this method: expected {}, found {}",
355+
num_method_types, num_supplied_types);
355356
final_substs.types.replace(
356357
subst::FnSpace,
357358
vec![self.tcx().types.err; num_method_types]);

src/test/compile-fail/trait-test-2.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah<X>(&self) {} }
1616

1717
fn main() {
1818
10.dup::<i32>(); //~ ERROR does not take type parameters
19-
10.blah::<i32, i32>(); //~ ERROR incorrect number of type parameters
19+
10.blah::<i32, i32>();
20+
//~^ ERROR incorrect number of type parameters given for this method: expected 1, found 2
2021
(box 10 as Box<bar>).dup();
2122
//~^ ERROR E0038
2223
//~| ERROR E0038

0 commit comments

Comments
 (0)