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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
369 B
Rust
Raw Normal View History

// run-pass
#![allow(unused_variables)]
2014-09-13 17:36:58 -05: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 17:36:58 -05:00
}
assert!(dropped);
}