Skip to content

Commit 90bf7cd

Browse files
committed
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
1 parent 1868a26 commit 90bf7cd

File tree

1 file changed

+3
-1
lines changed
  • src/librustc/middle/typeck/check

1 file changed

+3
-1
lines changed

src/librustc/middle/typeck/check/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2516,8 +2516,10 @@ fn check_argument_types<'a>(fcx: &FnCtxt,
25162516
"this function takes 0 parameters but {} parameter{} supplied",
25172517
args.len(),
25182518
if args.len() == 1 {" was"} else {"s were"});
2519+
err_args(args.len())
2520+
} else {
2521+
vec![]
25192522
}
2520-
Vec::new()
25212523
}
25222524
_ => {
25232525
span_err!(tcx.sess, sp, E0059,

0 commit comments

Comments
 (0)