about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-18 22:57:16 +0000
committerbors <bors@rust-lang.org>2014-10-18 22:57:16 +0000
commitd8cf0239713aa5683dc80872c4ea1962599e75e7 (patch)
tree6cb4edb977d3b94b5987a5a90afce54f2b734e52
parent1c82e60ca78da1f659db0c7dc82fe8c05566224f (diff)
parent0e68c63f3f148309bcc5c5f1358af49db393c619 (diff)
downloadrust-d8cf0239713aa5683dc80872c4ea1962599e75e7.tar.gz
rust-d8cf0239713aa5683dc80872c4ea1962599e75e7.zip
auto merge of #18109 : bkoropoff/rust/issue-16939, r=aturon
Closes #16939
-rw-r--r--src/librustc/middle/typeck/check/mod.rs4
-rw-r--r--src/test/compile-fail/issue-16939.rs20
2 files changed, 23 insertions, 1 deletions
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 8c37567bcd7..953ae0b9bd9 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -2523,8 +2523,10 @@ fn check_argument_types<'a>(fcx: &FnCtxt,
                         "this function takes 0 parameters but {} parameter{} supplied",
                         args.len(),
                         if args.len() == 1 {" was"} else {"s were"});
+                    err_args(args.len())
+                } else {
+                    vec![]
                 }
-                Vec::new()
             }
             _ => {
                 span_err!(tcx.sess, sp, E0059,
diff --git a/src/test/compile-fail/issue-16939.rs b/src/test/compile-fail/issue-16939.rs
new file mode 100644
index 00000000000..8e7a2a9db3d
--- /dev/null
+++ b/src/test/compile-fail/issue-16939.rs
@@ -0,0 +1,20 @@
+// Copyright 2014 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.
+
+#![feature(overloaded_calls)]
+
+// Make sure we don't ICE when making an overloaded call with the
+// wrong arity.
+
+fn _foo<F: Fn()> (f: F) {
+    |t| f(t); //~ ERROR E0058
+}
+
+fn main() {}