rust/tests/ui/issues/issue-17216.rs

22 lines
369 B
Rust
Raw Normal View History

// run-pass
#![allow(unused_variables)]
2014-09-13 22:36:58 +00:00
struct Leak<'a> {
dropped: &'a mut bool
}
impl<'a> Drop for Leak<'a> {
fn drop(&mut self) {
*self.dropped = true;
}
}
fn main() {
let mut dropped = false;
{
let leak = Leak { dropped: &mut dropped };
for ((), leaked) in Some(((), leak)).into_iter() {}
2014-09-13 22:36:58 +00:00
}
assert!(dropped);
}