Skip to content

Commit ef2c404

Browse files
committed
libcore/to_bytes.rs: fix IterBytes instances for pairs, triples to not cause ICE when used
1 parent d718bc2 commit ef2c404

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/libcore/to_bytes.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,19 +194,25 @@ impl<A: IterBytes> &[A]: IterBytes {
194194
impl<A: IterBytes, B: IterBytes> (A,B): IterBytes {
195195
#[inline(always)]
196196
pure fn iter_bytes(lsb0: bool, f: Cb) {
197-
let &(ref a, ref b) = &self;
198-
a.iter_bytes(lsb0, f);
199-
b.iter_bytes(lsb0, f);
197+
match self {
198+
(ref a, ref b) => {
199+
a.iter_bytes(lsb0, f);
200+
b.iter_bytes(lsb0, f);
201+
}
202+
}
200203
}
201204
}
202205

203206
impl<A: IterBytes, B: IterBytes, C: IterBytes> (A,B,C): IterBytes {
204207
#[inline(always)]
205208
pure fn iter_bytes(lsb0: bool, f: Cb) {
206-
let &(ref a, ref b, ref c) = &self;
207-
a.iter_bytes(lsb0, f);
208-
b.iter_bytes(lsb0, f);
209-
c.iter_bytes(lsb0, f);
209+
match self {
210+
(ref a, ref b, ref c) => {
211+
a.iter_bytes(lsb0, f);
212+
b.iter_bytes(lsb0, f);
213+
c.iter_bytes(lsb0, f);
214+
}
215+
}
210216
}
211217
}
212218

0 commit comments

Comments
 (0)