Custom vtables with integers

On the other hand it makes sense that there are limitations beyond what that RFC wrote. You probably wouldn't want

let x: &u32 = &(panic!() as _);

to panic at compile time, even though

static X: &'static u32 = &(panic!() as _);

compiles somewhat successfully (at least until it reports that compile-time panic).

And even more non-trivial than simple panics, non-terminating (or slow) computations would be hard to handle in non-confusing ways. (E. g.: Should static promotion be tried and then disregarding it becomes a silent fallback in case of panic or if evaluation is taking to long? But if hitting some evaluation limit turns into lifetime errors that would be weird and confusing.)

5 Likes