2 #![allow(unused_braces)]
4 #![allow(unused_unsafe)]
13 unsafe impl Sync
for Foo {}
15 fn foo
<T
>(a
: T
) -> T
{
19 static BLOCK_INTEGRAL
: usize = { 1 }
;
20 static BLOCK_EXPLICIT_UNIT
: () = { () }
;
21 static BLOCK_IMPLICIT_UNIT
: () = { }
;
22 static BLOCK_FLOAT
: f64 = { 1.0 }
;
23 static BLOCK_ENUM
: Option
<usize> = { Some(100) }
;
24 static BLOCK_STRUCT
: Foo
= { Foo { a: 12, b: std::ptr::null::<()>() }
};
25 static BLOCK_UNSAFE
: usize = unsafe { 1000 }
;
27 static BLOCK_FN_INFERRED
: fn(usize) -> usize = { foo }
;
29 static BLOCK_FN
: fn(usize) -> usize = { foo::<usize> }
;
31 static BLOCK_ENUM_CONSTRUCTOR
: fn(usize) -> Option
<usize> = { Some }
;
34 assert_eq
!(BLOCK_INTEGRAL
, 1);
35 assert_eq
!(BLOCK_EXPLICIT_UNIT
, ());
36 assert_eq
!(BLOCK_IMPLICIT_UNIT
, ());
37 assert_eq
!(BLOCK_FLOAT
, 1.0_f64);
38 assert_eq
!(BLOCK_STRUCT
.a
, 12);
39 assert_eq
!(BLOCK_STRUCT
.b
, std
::ptr
::null
::<()>());
40 assert_eq
!(BLOCK_ENUM
, Some(100));
41 assert_eq
!(BLOCK_UNSAFE
, 1000);
42 assert_eq
!(BLOCK_FN_INFERRED(300), 300);
43 assert_eq
!(BLOCK_FN(300), 300);
44 assert_eq
!(BLOCK_ENUM_CONSTRUCTOR(200), Some(200));