Skip to content

Commit 9b1a9ec

Browse files
committed
treemap: fix a bug in the union implementation
1 parent 2889a8a commit 9b1a9ec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libstd/treemap.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
486486
a = set_next(&mut x);
487487
}
488488
}
489+
do b.while_some |b1| {
490+
if f(b1) { set_next(&mut y) } else { None }
491+
}
489492
}
490493
}
491494
}
@@ -1182,6 +1185,7 @@ mod test_set {
11821185

11831186
check_union([], [], []);
11841187
check_union([1, 2, 3], [2], [1, 2, 3]);
1188+
check_union([2], [1, 2, 3], [1, 2, 3]);
11851189
check_union([1, 3, 5, 9, 11, 16, 19, 24],
11861190
[-2, 1, 5, 9, 13, 19],
11871191
[-2, 1, 3, 5, 9, 11, 13, 16, 19, 24]);

0 commit comments

Comments
 (0)