Fix ICE in overloaded call with incorrect arity

When an overloaded call expression has parameters but the function
object takes none, construct an array of formal argument types with
the arity of the call expression so that we don't fail by indexing out
of bounds later.

Closes #16939
This commit is contained in:
Brian Koropoff 2014-10-16 19:03:29 -07:00
parent 1868a262f3
commit 90bf7cdd79
1 changed files with 3 additions and 1 deletions

View File

@ -2516,8 +2516,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,