[][src]Macro zerogc::unsafe_gc_brand

macro_rules! unsafe_gc_brand {
    ($target:tt) => { ... };
    ($target:ident, $($param:ident),+) => { ... };
    ($target:tt, immut = required; $($param:ident),+) => { ... };
}

Unsafely assume that the generic implementation of [GcBrand] is valid, if and only if it's valid for the generic lifetime and type parameters.

Always prefer automatically derived implementations where possible, since they can never cause undefined behavior. This macro is only necessary if you have raw pointers internally, which can't have automatically derived safe implementations. This is basically an unsafe automatically derived implementation, to be used only when a safe automatically derived implementation isn't possible (like with Vec).

This macro takes a varying number of parameters referring to the type's generic parameters, which are all properly bounded and required to implement [GcBrand] correctly.

This macro can only cause undefined behavior if there are garbage collected pointers that aren't included in the type parameter. For example including Gc<u32> would be completely undefined behavior, since we'd blindly erase its lifetime.

However, generally this macro provides the correct implementation for straighrtforward wrapper/collection types. Currently the only exception is when you have garbage collected lifetimes like Gc.