Skip to content
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

Update error E0035 and E0036 #35206 #35207 #35561

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 10 additions & 6 deletions src/librustc_typeck/check/method/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,17 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {

if num_supplied_types > 0 && num_supplied_types != num_method_types {
if num_method_types == 0 {
span_err!(self.tcx.sess, self.span, E0035,
"does not take type parameters");
struct_span_err!(self.tcx.sess, self.span, E0035,
"does not take type parameters")
.span_label(self.span, &format!("called with unneeded type parameters"))
.emit();
} else {
span_err!(self.tcx.sess, self.span, E0036,
"incorrect number of type parameters given for this method: \
expected {}, found {}",
num_method_types, num_supplied_types);
struct_span_err!(self.tcx.sess, self.span, E0036,
"incorrect number of type parameters given for this method: expected {}, found {}",
num_method_types, num_supplied_types)
.span_label(self.span, &format!("Passed {} type argument(s), expected {}",
num_supplied_types, num_method_types))
.emit();
}
supplied_method_types = vec![self.tcx.types.err; num_method_types];
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0035.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ impl Test {
fn main() {
let x = Test;
x.method::<i32>(); //~ ERROR E0035
//~| NOTE called with unneeded type parameters
}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0036.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ fn main() {
let x = Test;
let v = &[0];
x.method::<i32, i32>(v); //~ ERROR E0036
//~| NOTE Passed 2 type arguments, expected 1
}