Macro intern_all::tl_cache

source ·
macro_rules! tl_cache {
    ($data:expr) => { ... };
}
Expand description

Cache any expression while staying in expression scope. The expression gets put in a type-erased thread-local box, and it’s downcast and cloned every time the expression is called at runtime.

§Panics

If the enclosed expression can have multiple possible types and the point-of-use unifies to a different type than the default. I’m not aware of a way to statically detect this so it’s just a panic.

The most obvious way in which this can happen is with integer literals which default to i32 but can unify seamlessly to any other integer type, but it could also be caused by autoref/autoderef. In either case, rust-analyzer can tell you the type of both the nested expression and the