File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 3
3
#![ feature( const_fn_trait_bound) ]
4
4
#![ feature( generic_const_exprs) ]
5
5
#![ feature( adt_const_params) ]
6
+ #![ feature( naked_functions) ]
6
7
#![ feature( core_panic) ]
7
8
#![ feature( decl_macro) ]
9
+ #![ feature( asm_const) ]
10
+ #![ feature( asm_sym) ]
8
11
#![ cfg_attr(
9
12
feature = "doc" ,
10
13
doc( html_logo_url = "https://r3-os.github.io/r3/logo-small.svg" )
Original file line number Diff line number Diff line change @@ -272,3 +272,28 @@ pub macro sym_static {
272
272
}
273
273
} ,
274
274
}
275
+
276
+ #[ cfg( test) ]
277
+ mod tests {
278
+ use super:: * ;
279
+ extern crate std;
280
+ use std:: { dbg, prelude:: rust_2021:: * } ;
281
+
282
+ trait Tr {
283
+ sym_static !( static VAR : SymStatic <u32> = zeroed ! ( ) ) ;
284
+ }
285
+
286
+ impl Tr for & ' static u8 { }
287
+ impl Tr for & ' static u16 { }
288
+ impl Tr for & ' static u32 { }
289
+
290
+ #[ test]
291
+ fn uniqueness( ) {
292
+ let var1 = dbg ! ( sym_static( <& ' static u8 >:: VAR ) . as_ptr( ) ) ;
293
+ let var2 = dbg ! ( sym_static( <& ' static u16 >:: VAR ) . as_ptr( ) ) ;
294
+ let var3 = dbg ! ( sym_static( <& ' static u32 >:: VAR ) . as_ptr( ) ) ;
295
+ assert_ne ! ( var1, var2) ;
296
+ assert_ne ! ( var2, var3) ;
297
+ assert_ne ! ( var1, var3) ;
298
+ }
299
+ }
You can’t perform that action at this time.
0 commit comments