about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-03-10 20:44:18 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-03-11 22:36:23 -0400
commit9b1a9ec4ea87d3ff25ecf361c78c6119590d62a9 (patch)
tree5916091c628047aed3e91bf5a2cb0bf9436e94af /src/libstd
parent2889a8a4e5a490cf650d3730bc05a1694a1d3310 (diff)
downloadrust-9b1a9ec4ea87d3ff25ecf361c78c6119590d62a9.tar.gz
rust-9b1a9ec4ea87d3ff25ecf361c78c6119590d62a9.zip
treemap: fix a bug in the union implementation
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/treemap.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index 28ed95a0978..42a84da43d2 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -486,6 +486,9 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
                     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]);