3 #![feature(const_type_name)]
6 const fn type_name_wrapper
<T
>(_
: &T
) -> &'
static str {
7 std
::any
::type_name
::<T
>()
10 struct Struct
<TA
, TB
, TC
> {
16 type StructInstantiation
= Struct
<i8, f64, bool
>;
18 const CONST_STRUCT
: StructInstantiation
= StructInstantiation { a: 12, b: 13.7, c: false }
;
20 const CONST_STRUCT_NAME
: &'
static str = type_name_wrapper(&CONST_STRUCT
);
23 let non_const_struct
= StructInstantiation { a: 87, b: 65.99, c: true }
;
25 let non_const_struct_name
= type_name_wrapper(&non_const_struct
);
27 assert_eq
!(CONST_STRUCT_NAME
, non_const_struct_name
);