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:
parent
1868a262f3
commit
90bf7cdd79
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue