test BTreeMap::drain_filter for leaks

This commit is contained in:
Ralf Jung 2020-09-11 12:20:08 +02:00
parent a6741b0592
commit bc548d3004

View file

@ -1,4 +1,6 @@
#![feature(btree_drain_filter)]
use std::collections::{BTreeMap, BTreeSet};
use std::mem;
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub enum Foo {
@ -43,4 +45,9 @@ pub fn main() {
b.insert(format!("key{}", i), i);
}
test_all_refs(&mut 13, b.values_mut());
// Test forgetting the drain.
let mut d = b.drain_filter(|_, i| *i < 30);
d.next().unwrap();
mem::forget(d);
}