]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-17216.rs
Merge commit '54a20a02ecd0e1352a871aa0990bcc8b8b03173e' into clippyup
[rust.git] / src / test / ui / issues / issue-17216.rs
1 // run-pass
2 #![allow(unused_variables)]
3 struct Leak<'a> {
4     dropped: &'a mut bool
5 }
6
7 impl<'a> Drop for Leak<'a> {
8     fn drop(&mut self) {
9         *self.dropped = true;
10     }
11 }
12
13 fn main() {
14     let mut dropped = false;
15     {
16         let leak = Leak { dropped: &mut dropped };
17         for ((), leaked) in Some(((), leak)).into_iter() {}
18     }
19
20     assert!(dropped);
21 }