From 1571abae53d77f36352b543a595969f1ef21503b Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Sun, 2 Nov 2014 19:26:14 -0800 Subject: [PATCH] Fix ICE when checking call overload If the overloaded method does not have a tuple or unit type as its first non-self parameter, produce a list of error types with the correct length to prevent a later index bound panic. This typically occurs due to propagation of an earlier type error or unconstrained type variable. Closes #18532 --- src/librustc/middle/typeck/check/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index f334d801692..60eefbceded 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -2536,7 +2536,7 @@ fn check_argument_types<'a>(fcx: &FnCtxt, span_err!(tcx.sess, sp, E0059, "cannot use call notation; the first type parameter \ for the function trait is neither a tuple nor unit"); - err_args(supplied_arg_count) + err_args(args.len()) } } } else if expected_arg_count == supplied_arg_count {