Skip to content

Commit 13e1816

Browse files
committed
---
yaml --- r: 142525 b: refs/heads/try2 c: 366a233 h: refs/heads/master i: 142523: 1c75745 v: v3
1 parent cbc3482 commit 13e1816

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 9999622e44558a6b138e7d5e3e98ba5db2eb1465
8+
refs/heads/try2: 366a233dbda597192b5ad027fe79f58331bc1bed
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libsyntax/ext/deriving/generic.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ impl<'self> MethodDef<'self> {
589589

590590
// transpose raw_fields
591591
let fields = match raw_fields {
592-
[self_arg, .. rest] => {
592+
[ref self_arg, .. rest] => {
593593
do self_arg.iter().enumerate().transform |(i, &(opt_id, field))| {
594594
let other_fields = do rest.map |l| {
595595
match &l[i] {
@@ -738,16 +738,20 @@ impl<'self> MethodDef<'self> {
738738

739739
let mut enum_matching_fields = vec::from_elem(self_vec.len(), ~[]);
740740

741-
for matches_so_far.tail().iter().advance |&(_, _, other_fields)| {
742-
for other_fields.iter().enumerate().advance |(i, &(_, other_field))| {
743-
enum_matching_fields[i].push(other_field);
741+
for matches_so_far.tail().iter().advance |triple| {
742+
match triple {
743+
&(_, _, ref other_fields) => {
744+
for other_fields.iter().enumerate().advance |(i, pair)| {
745+
enum_matching_fields[i].push(pair.second());
746+
}
747+
}
744748
}
745749
}
746750
let field_tuples =
747751
do self_vec.iter()
748752
.zip(enum_matching_fields.iter())
749-
.transform |(&(id, self_f), &other)| {
750-
(id, self_f, other)
753+
.transform |(&(id, self_f), other)| {
754+
(id, self_f, copy *other)
751755
}.collect();
752756
substructure = EnumMatching(variant_index, variant, field_tuples);
753757
}
@@ -1015,19 +1019,22 @@ left-to-right (`true`) or right-to-left (`false`).
10151019
pub fn cs_fold(use_foldl: bool,
10161020
f: &fn(@ExtCtxt, span,
10171021
old: @expr,
1018-
self_f: @expr, other_fs: &[@expr]) -> @expr,
1022+
self_f: @expr,
1023+
other_fs: &[@expr]) -> @expr,
10191024
base: @expr,
10201025
enum_nonmatch_f: EnumNonMatchFunc,
10211026
cx: @ExtCtxt, span: span,
10221027
substructure: &Substructure) -> @expr {
10231028
match *substructure.fields {
10241029
EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => {
10251030
if use_foldl {
1026-
do all_fields.iter().fold(base) |old, &(_, self_f, other_fs)| {
1031+
do all_fields.iter().fold(base) |old, triple| {
1032+
let (_, self_f, other_fs) = copy *triple;
10271033
f(cx, span, old, self_f, other_fs)
10281034
}
10291035
} else {
1030-
do all_fields.rev_iter().fold(base) |old, &(_, self_f, other_fs)| {
1036+
do all_fields.rev_iter().fold(base) |old, triple| {
1037+
let (_, self_f, other_fs) = copy *triple;
10311038
f(cx, span, old, self_f, other_fs)
10321039
}
10331040
}
@@ -1059,7 +1066,8 @@ pub fn cs_same_method(f: &fn(@ExtCtxt, span, ~[@expr]) -> @expr,
10591066
match *substructure.fields {
10601067
EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => {
10611068
// call self_n.method(other_1_n, other_2_n, ...)
1062-
let called = do all_fields.map |&(_, self_field, other_fields)| {
1069+
let called = do all_fields.map |triple| {
1070+
let (_, self_field, other_fields) = copy *triple;
10631071
cx.expr_method_call(span,
10641072
self_field,
10651073
substructure.method_ident,

branches/try2/src/libsyntax/ext/pipes/proto.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ pub fn visit<Tproto, Tstate, Tmessage, V: visitor<Tproto, Tstate, Tmessage>>(
215215

216216
// the copy keywords prevent recursive use of dvec
217217
let states: ~[Tstate] = do (copy proto.states).iter().transform |&s| {
218-
let messages: ~[Tmessage] = do (copy s.messages).iter().transform |&m| {
219-
let message(name, span, tys, this, next) = m;
218+
let messages: ~[Tmessage] = do (copy s.messages).iter().transform |m| {
219+
let message(name, span, tys, this, next) = copy *m;
220220
visitor.visit_message(name, span, tys, this, next)
221221
}.collect();
222222
visitor.visit_state(s, messages)

0 commit comments

Comments
 (0)