From ef2c404e01108a7bd7465bd23d40ff989848bffd Mon Sep 17 00:00:00 2001 From: Michael Arntzenius Date: Wed, 28 Nov 2012 22:55:51 -0500 Subject: [PATCH] libcore/to_bytes.rs: fix IterBytes instances for pairs, triples to not cause ICE when used --- src/libcore/to_bytes.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index 3aaa3ab8d918..238b4342a637 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -194,19 +194,25 @@ impl &[A]: IterBytes { impl (A,B): IterBytes { #[inline(always)] pure fn iter_bytes(lsb0: bool, f: Cb) { - let &(ref a, ref b) = &self; - a.iter_bytes(lsb0, f); - b.iter_bytes(lsb0, f); + match self { + (ref a, ref b) => { + a.iter_bytes(lsb0, f); + b.iter_bytes(lsb0, f); + } + } } } impl (A,B,C): IterBytes { #[inline(always)] pure fn iter_bytes(lsb0: bool, f: Cb) { - let &(ref a, ref b, ref c) = &self; - a.iter_bytes(lsb0, f); - b.iter_bytes(lsb0, f); - c.iter_bytes(lsb0, f); + match self { + (ref a, ref b, ref c) => { + a.iter_bytes(lsb0, f); + b.iter_bytes(lsb0, f); + c.iter_bytes(lsb0, f); + } + } } }