From 9b1a9ec4ea87d3ff25ecf361c78c6119590d62a9 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 10 Mar 2013 20:44:18 -0400 Subject: [PATCH] treemap: fix a bug in the union implementation --- src/libstd/treemap.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 28ed95a0978b..42a84da43d25 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -486,6 +486,9 @@ impl Set for TreeSet { a = set_next(&mut x); } } + do b.while_some |b1| { + if f(b1) { set_next(&mut y) } else { None } + } } } } @@ -1182,6 +1185,7 @@ mod test_set { check_union([], [], []); check_union([1, 2, 3], [2], [1, 2, 3]); + check_union([2], [1, 2, 3], [1, 2, 3]); check_union([1, 3, 5, 9, 11, 16, 19, 24], [-2, 1, 5, 9, 13, 19], [-2, 1, 3, 5, 9, 11, 13, 16, 19, 24]);