about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-12-09 09:54:55 +0000
committerbors <bors@rust-lang.org>2017-12-09 09:54:55 +0000
commit6537fd184eff31220eda42712a13f48684e8463a (patch)
tree1122763428e614312e9a2ab18289f6630da4a572 /src/liballoc
parent61cc23e3e577af740e6ca94cc909b9921bdff5ec (diff)
parentcdf1d7dfc94e1bc7b103af3ae466e5271ce00113 (diff)
downloadrust-6537fd184eff31220eda42712a13f48684e8463a.tar.gz
rust-6537fd184eff31220eda42712a13f48684e8463a.zip
Auto merge of #46581 - tmccombs:drain_filter_drop, r=sfackler
Add Drop impl for linked_list::DrainFilter

This is part of #43244. See https://github.com/rust-lang/rust/issues/43244#issuecomment-349894355
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/linked_list.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/liballoc/linked_list.rs b/src/liballoc/linked_list.rs
index 0fe3c972422..3ac5a85d721 100644
--- a/src/liballoc/linked_list.rs
+++ b/src/liballoc/linked_list.rs
@@ -1072,6 +1072,15 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
 }
 
 #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
+impl<'a, T, F> Drop for DrainFilter<'a, T, F>
+    where F: FnMut(&mut T) -> bool,
+{
+    fn drop(&mut self) {
+        for _ in self { }
+    }
+}
+
+#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
 impl<'a, T: 'a + fmt::Debug, F> fmt::Debug for DrainFilter<'a, T, F>
     where F: FnMut(&mut T) -> bool
 {