Skip to main content

assert_not_impl

Macro assert_not_impl 

Source
macro_rules! assert_not_impl {
    {[$rule:ident] $t:ty : $trait:path } => { ... };
}
Expand description

Give a compile time error if the type $t implements $trait.

Includes the identifier $rule in the error message, to help the user diagnose the problem. (This is the main difference between this macro and the one in static_assertions.)

§Example (Succeeding.)

// No error will occur; String is not Buildable.
tor_config::derive::assert_not_impl!{
    [copy_is_forbidden_here] String : tor_config::load::Buildable
}
// Compile-time error _is_ given; String implements Clone.
tor_config::derive::assert_not_impl!{
    [clone_is_forbidden_here] String : Clone
}