]>
Commit | Line | Data |
---|---|---|
dfeec247 XL |
1 | // compile-flags: -Z mir-opt-level=2 |
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 | } |