]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-16151.rs
Enable full revision in const generics ui tests
[rust.git] / src / test / ui / issues / issue-16151.rs
1 // run-pass
2
3 use std::mem;
4
5 static mut DROP_COUNT: usize = 0;
6
7 struct Fragment;
8
9 impl Drop for Fragment {
10     fn drop(&mut self) {
11         unsafe {
12             DROP_COUNT += 1;
13         }
14     }
15 }
16
17 fn main() {
18     {
19         let mut fragments = vec![Fragment, Fragment, Fragment];
20         let _new_fragments: Vec<Fragment> = mem::replace(&mut fragments, vec![])
21             .into_iter()
22             .skip_while(|_fragment| {
23                 true
24             }).collect();
25     }
26     unsafe {
27         assert_eq!(DROP_COUNT, 3);
28     }
29 }