[−][src]Macro static_assertions::assert_eq_type
Asserts that types are equal.
Examples
On stable Rust, using the macro requires a unique “label” when used in a module scope:
type A = u8; type B = A; assert_eq_type!(byte; u8, A, B);
The labeling limitation is not necessary if
compiling on nightly Rust with the nightly
feature enabled:
ⓘThis example is not tested
#![feature(underscore_const_names)] assert_eq_type!(u8, A, B);
The following produces a compilation failure because usize
and u64
do
not refer to the same type:
ⓘThis example deliberately fails to compile
assert_eq_type!(usize, u64);