about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKang Seonghoon <public+git@mearie.org>2013-02-20 00:52:20 +0900
committerKang Seonghoon <public+git@mearie.org>2013-02-20 00:53:54 +0900
commitf513c567cb5b02a514af3903941434efd0b8a5eb (patch)
treeddf1085cf7da9ec3585099864594f7365ce499ef
parentacc147769ec8ad6193ee04719dac67d1e66466c4 (diff)
fix ICE after incorrect number of args in calls
-rw-r--r--src/librustc/middle/typeck/check/mod.rs2
-rw-r--r--src/test/compile-fail/issue-4935.rs14
2 files changed, 15 insertions, 1 deletions
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 1ad3bd9cae6..8f8eb893622 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -1198,7 +1198,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
 
                     tcx.sess.span_err(sp, msg);
 
-                    vec::from_fn(expected_arg_count, |_| ty::mk_err(tcx))
+                    vec::from_fn(supplied_arg_count, |_| ty::mk_err(tcx))
                 };
 
                 sig.output
diff --git a/src/test/compile-fail/issue-4935.rs b/src/test/compile-fail/issue-4935.rs
new file mode 100644
index 00000000000..4bb3a511944
--- /dev/null
+++ b/src/test/compile-fail/issue-4935.rs
@@ -0,0 +1,14 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regresion test for issue #4935
+
+fn foo(a: uint) {}
+fn main() { foo(5, 6) } //~ ERROR this function takes 1 parameter but 2 parameters were supplied