Macro static_assertions::assert_ne_type [−][src]
macro_rules! assert_ne_type { ($($xs:tt)+) => { ... }; }
Expand description
Asserts that types are not equal.
Examples
On stable Rust, using the macro requires a unique “label” when used in a module scope:
assert_ne_type!(slices; [u8], [u16], str);
The labeling limitation is not necessary if
compiling on nightly Rust with the nightly
feature enabled:
ⓘ
#![feature(underscore_const_names)] assert_ne_type!(u8, (u8,), [u8]);
The following produces a compilation failure because c_uchar
is a type
alias for u8
:
ⓘ
assert_ne_type!(std::os::raw::c_uchar, u8, u32); assert_ne_type!(std::os::raw::c_uchar, u32, u8); assert_ne_type!(u32, std::os::raw::c_uchar, u8);