Skip to content

Commit d46c765

Browse files
committed
---
yaml --- r: 5118 b: refs/heads/master c: 3690f38 h: refs/heads/master v: v3
1 parent b367ecf commit d46c765

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1262df652f766782253fed51526ba60609859719
2+
refs/heads/master: 3690f38d798b2a0009af9c18ba034f7a2411390e

trunk/src/comp/middle/tstate/auxiliary.rs

+18-4
Original file line numberDiff line numberDiff line change
@@ -1048,10 +1048,24 @@ fn do_nothing<T>(_f: &_fn, _tp: &[ty_param], _sp: &span, _i: &fn_ident,
10481048
}
10491049

10501050

1051-
fn args_to_constr_args(sp: &span, args: &[arg]) -> [@constr_arg_use] {
1051+
fn args_to_constr_args(tcx: &ty::ctxt, args: &[arg],
1052+
indices:&[@sp_constr_arg<uint>]) -> [@constr_arg_use] {
10521053
let actuals: [@constr_arg_use] = [];
1053-
for a: arg in args {
1054-
actuals += [@respan(sp, carg_ident({ident: a.ident, node: a.id}))];
1054+
let num_args = vec::len(args);
1055+
for a:@sp_constr_arg<uint> in indices {
1056+
actuals += [@respan(a.span, alt a.node {
1057+
carg_base. { carg_base }
1058+
carg_ident(i) {
1059+
if i < num_args {
1060+
carg_ident({ident: args[i].ident, node:args[i].id})
1061+
}
1062+
else {
1063+
tcx.sess.span_bug(a.span, ~"Index out of bounds in \
1064+
constraint arg");
1065+
}
1066+
}
1067+
carg_lit(l) { carg_lit(l) }
1068+
})];
10551069
}
10561070
ret actuals;
10571071
}
@@ -1060,7 +1074,7 @@ fn ast_constr_to_ts_constr(tcx: &ty::ctxt, args: &[arg], c: &@constr) ->
10601074
tsconstr {
10611075
let tconstr = ty::ast_constr_to_constr(tcx, c);
10621076
ret npred(tconstr.node.path, tconstr.node.id,
1063-
args_to_constr_args(tconstr.span, args));
1077+
args_to_constr_args(tcx, args, tconstr.node.args));
10641078
}
10651079

10661080
fn ast_constr_to_sp_constr(tcx: &ty::ctxt, args: &[arg], c: &@constr) ->

trunk/src/test/run-pass/bug-862.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pure fn p(j: int) -> bool { true }
2+
3+
fn f(i: int, j: int) : p(j) -> int { j }
4+
5+
fn g(i: int, j: int) : p(j) -> int { f(i, j) }
6+
7+
fn main() {
8+
let x = 1;
9+
check p(x);
10+
log g(x, x);
11+
}

0 commit comments

Comments
 (0)