summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-17216.rs
blob: 05baa1bffdd80ed032aef1214a4c9278818820a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// run-pass
#![allow(unused_variables)]
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() {}
    }

    assert!(dropped);
}