]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/drop/nondrop-cycle.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / drop / nondrop-cycle.rs
1 // run-pass
2 // pretty-expanded FIXME #23616
3
4 use std::cell::Cell;
5
6 struct C<'a> {
7 p: Cell<Option<&'a C<'a>>>,
8 }
9
10 impl<'a> C<'a> {
11 fn new() -> C<'a> { C { p: Cell::new(None) } }
12 }
13
14 fn f1() {
15 let (c1, c2) = (C::new(), C::new());
16 c1.p.set(Some(&c2));
17 c2.p.set(Some(&c1));
18 }
19
20 fn f2() {
21 let (c1, c2);
22 c1 = C::new();
23 c2 = C::new();
24 c1.p.set(Some(&c2));
25 c2.p.set(Some(&c1));
26 }
27
28 fn main() {
29 f1();
30 f2();
31 }