]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-8860.rs
Enable full revision in const generics ui tests
[rust.git] / src / test / ui / issues / issue-8860.rs
1 // run-pass
2 #![allow(dead_code)]
3
4 static mut DROP: isize = 0;
5 static mut DROP_S: isize = 0;
6 static mut DROP_T: isize = 0;
7
8 struct S;
9 impl Drop for S {
10     fn drop(&mut self) {
11         unsafe {
12             DROP_S += 1;
13             DROP += 1;
14         }
15     }
16 }
17 fn f(ref _s: S) {}
18
19 struct T { i: isize }
20 impl Drop for T {
21     fn drop(&mut self) {
22         unsafe {
23             DROP_T += 1;
24             DROP += 1;
25         }
26     }
27 }
28 fn g(ref _t: T) {}
29
30 fn do_test() {
31     let s = S;
32     f(s);
33     unsafe {
34         assert_eq!(1, DROP);
35         assert_eq!(1, DROP_S);
36     }
37     let t = T { i: 1 };
38     g(t);
39     unsafe { assert_eq!(1, DROP_T); }
40 }
41
42 fn main() {
43     do_test();
44     unsafe {
45         assert_eq!(2, DROP);
46         assert_eq!(1, DROP_S);
47         assert_eq!(1, DROP_T);
48     }
49 }