Ada does this too
Ada does this too
Posted Feb 12, 2025 20:30 UTC (Wed) by NYKevin (subscriber, #129325)In reply to: Ada does this too by NYKevin
Parent article: Maintainer opinions on Rust-for-Linux
Of course, if Drop::drop is actually never used, and there is actually no drop glue for Linear<T>, then it will be elided at link time. But that's too late for const blocks to be evaluated, at least in my understanding of the Rust compilation process. You would instead have to define the object's Drop::drop in such a way as to trigger a linker error. I think you can do that, but then the error message will probably make no sense to the user (whereas a const assert can at least print a string telling you the general shape of the problem).