File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ // check-pass
2
+ #![ allow( non_camel_case_types, non_upper_case_globals, static_mut_ref) ]
3
+
4
+ pub struct wl_interface {
5
+ pub version : i32
6
+ }
7
+
8
+ pub struct Interface {
9
+ pub other_interfaces : & ' static [ & ' static Interface ] ,
10
+ pub c_ptr : Option < & ' static wl_interface > ,
11
+ }
12
+
13
+ pub static mut wl_callback_interface: wl_interface = wl_interface {
14
+ version : 0 ,
15
+ } ;
16
+
17
+ pub static WL_CALLBACK_INTERFACE : Interface = Interface {
18
+ other_interfaces : & [ ] ,
19
+ c_ptr : Some ( unsafe { & wl_callback_interface } ) ,
20
+ } ;
21
+
22
+ // This static contains a promoted that points to a static that points to a mutable static.
23
+ pub static WL_SURFACE_INTERFACE : Interface = Interface {
24
+ other_interfaces : & [ & WL_CALLBACK_INTERFACE ] ,
25
+ c_ptr : None ,
26
+ } ;
27
+
28
+ // And another variant of the same thing, this time with interior mutability.
29
+ use std:: sync:: OnceLock ;
30
+ static LAZY_INIT : OnceLock < u32 > = OnceLock :: new ( ) ;
31
+ static LAZY_INIT_REF : & [ & OnceLock < u32 > ] = & [ & LAZY_INIT ] ;
32
+
33
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments