Skip to content

Commit 1312154

Browse files
committed
---
yaml --- r: 15183 b: refs/heads/try c: fe610f0 h: refs/heads/master i: 15181: 6689480 15179: 16dc1a2 15175: 42d77fa 15167: d234810 v: v3
1 parent f8645fc commit 1312154

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 23f92ea3701d515ac617c4c9ad18d4b25ecd4675
5+
refs/heads/try: fe610f04d89ae30e7ad68b9b519aa8461cd8d0fb
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/typeck.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,11 +2362,13 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
23622362
} else {
23632363
"s were"
23642364
}]);
2365-
// HACK: build an arguments list with dummy arguments to
2366-
// check against
2367-
let dummy = {mode: ast::expl(ast::by_ref),
2368-
ty: ty::mk_bot(fcx.ccx.tcx)};
2369-
arg_tys = vec::from_elem(supplied_arg_count, dummy);
2365+
2366+
// Just use fresh type variables for the types,
2367+
// since we don't know them.
2368+
arg_tys = vec::from_fn(supplied_arg_count) {|_i|
2369+
{mode: ast::expl(ast::by_ref),
2370+
ty: next_ty_var(fcx)}
2371+
};
23702372
}
23712373

23722374
// Check the arguments.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Check that the only error msg we report is the
2+
// mismatch between the # of params, and not other
3+
// unrelated errors.
4+
5+
fn foo(a: int, b: int, c: int, d:int) {
6+
fail;
7+
}
8+
9+
fn main() {
10+
foo(1, 2, 3);
11+
//!^ ERROR this function takes 4 parameters but 3
12+
}

0 commit comments

Comments
 (0)