2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![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 };
|
2015-02-26 07:22:13 -06:00
|
|
|
for ((), leaked) in Some(((), leak)).into_iter() {}
|
2014-09-13 17:36:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
assert!(dropped);
|
|
|
|
}
|