]> git.lizzy.rs Git - rust.git/blob - src/test/ui/drop/nondrop-cycle.rs
Auto merge of #102684 - JhonnyBillM:delete-target-data-layout-errors-wrapper, r=davidtwco
[rust.git] / src / test / ui / 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 }