@@ -1048,10 +1048,24 @@ fn do_nothing<T>(_f: &_fn, _tp: &[ty_param], _sp: &span, _i: &fn_ident,
1048
1048
}
1049
1049
1050
1050
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 ] {
1052
1053
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
+ } ) ] ;
1055
1069
}
1056
1070
ret actuals;
1057
1071
}
@@ -1060,7 +1074,7 @@ fn ast_constr_to_ts_constr(tcx: &ty::ctxt, args: &[arg], c: &@constr) ->
1060
1074
tsconstr {
1061
1075
let tconstr = ty:: ast_constr_to_constr ( tcx, c) ;
1062
1076
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 ) ) ;
1064
1078
}
1065
1079
1066
1080
fn ast_constr_to_sp_constr ( tcx : & ty:: ctxt , args : & [ arg ] , c : & @constr ) ->
0 commit comments