]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/issue-67641.rs
Rollup merge of #106699 - eholk:await-chains-drop-tracking, r=wesleywiser
[rust.git] / tests / ui / consts / issue-67641.rs
1 // compile-flags: -Z mir-opt-level=3
2 // run-pass
3
4 use std::cell::Cell;
5
6 #[derive(Debug)]
7 struct B<'a> {
8     a: [Cell<Option<&'a B<'a>>>; 2]
9 }
10
11 impl<'a> B<'a> {
12     fn new() -> B<'a> {
13         B { a: [Cell::new(None), Cell::new(None)] }
14     }
15 }
16
17 fn f() {
18     let b2 = B::new();
19     b2.a[0].set(Some(&b2));
20 }
21
22 fn main() {
23     f();
24 }