Skip to content

librustc_typeck: give more information when supplied wrong number of … #29705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librustc_typeck/check/method/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
3 changes: 2 additions & 1 deletion src/test/compile-fail/trait-test-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah<X>(&self) {} }

fn main() {
10.dup::<i32>(); //~ ERROR does not take type parameters
10.blah::<i32, i32>(); //~ ERROR incorrect number of type parameters
10.blah::<i32, i32>();
//~^ ERROR incorrect number of type parameters given for this method: expected 1, found 2
(box 10 as Box<bar>).dup();
//~^ ERROR E0038
//~| ERROR E0038
Expand Down