Skip to content

Commit fed2bc7

Browse files
committed
---
yaml --- r: 7068 b: refs/heads/master c: 7c1f683 h: refs/heads/master v: v3
1 parent ad596df commit fed2bc7

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 295df68faf1e881d7fda09406f47bb99ef7f4d43
2+
refs/heads/master: 7c1f683c6d93cdb5fee8a664cd6b5ff2397e1d04

trunk/src/comp/middle/trans_impl.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ fn trans_dict_callee(bcx: @block_ctxt, e: @ast::expr, base: @ast::expr,
5555
let generic = none;
5656
if vec::len(*method.tps) > 0u {
5757
let tydescs = [], tis = [];
58-
for t in ty::node_id_to_type_params(tcx, e.id) {
58+
let tptys = ty::node_id_to_type_params(tcx, e.id);
59+
for t in vec::tail_n(tptys, vec::len(tptys) - vec::len(*method.tps)) {
5960
// TODO: Doesn't always escape.
6061
let ti = none;
6162
let td = get_tydesc(bcx, t, true, tps_normal, ti).result;

trunk/src/comp/middle/typeck.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1037,16 +1037,16 @@ mod writeback {
10371037
};
10381038
let new_substs_opt;
10391039
alt tpot.substs {
1040-
none::<[ty::t]>. { new_substs_opt = none::<[ty::t]>; }
1041-
some::<[ty::t]>(substs) {
1040+
none. { new_substs_opt = none; }
1041+
some(substs) {
10421042
let new_substs: [ty::t] = [];
10431043
for subst: ty::t in substs {
10441044
alt resolve_type_vars_in_type(fcx, sp, subst) {
10451045
some(t) { new_substs += [t]; }
10461046
none. { wbcx.success = false; ret; }
10471047
}
10481048
}
1049-
new_substs_opt = some::<[ty::t]>(new_substs);
1049+
new_substs_opt = some(new_substs);
10501050
}
10511051
}
10521052
write::ty(fcx.ccx.tcx, id, {substs: new_substs_opt, ty: new_ty});
@@ -1568,7 +1568,6 @@ fn lookup_method(fcx: @fn_ctxt, isc: resolve::iscopes,
15681568
}
15691569
bound_n += 1u;
15701570
}
1571-
_ {}
15721571
}
15731572
}
15741573
ret none;

trunk/src/libcore/vec.rs

+10
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ fn tail<T: copy>(v: [const T]) : is_not_empty(v) -> [T] {
195195
ret slice(v, 1u, len(v));
196196
}
197197

198+
/*
199+
Function tail_n
200+
201+
Returns all but the first N elements of a vector
202+
*/
203+
204+
fn tail_n<T: copy>(v: [const T], n: uint) -> [T] {
205+
slice(v, n, len(v))
206+
}
207+
198208
// FIXME: This name is sort of confusing next to init_fn, etc
199209
// but this is the name haskell uses for this function,
200210
// along with head/tail/last.

trunk/src/test/run-pass/iface-generic.rs

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ impl of to_str for int {
99
impl of to_str for str {
1010
fn to_str() -> str { self }
1111
}
12+
impl of to_str for () {
13+
fn to_str() -> str { "()" }
14+
}
1215

1316
iface map<T> {
1417
fn map<U>(f: block(T) -> U) -> [U];
@@ -32,4 +35,5 @@ fn main() {
3235
assert foo([1]) == ["hi"];
3336
assert bar::<int, [int]>([4, 5]) == ["4", "5"];
3437
assert bar::<str, [str]>(["x", "y"]) == ["x", "y"];
38+
assert bar::<(), [()]>([()]) == ["()"];
3539
}

0 commit comments

Comments
 (0)