Comment by tasn

4 hours ago

How did you implement this runtime check? Is it a lint rule, or using the type system?

It’s a compile-time check, and yeah it’s a lint rule. In fact it goes a little deeper than a lint can go, because it uses data from earlier compiler phases (in order to get access to what the borrow checker knows.) The correct terminology is a “rustc driver” from what I’ve heard. Lints like clippy run as a “LateLintPass”, which doesn’t have access to certain mir data that is intentionally deleted in earlier phases to lower the memory requirements.

Hopefully it’s something I can open source soon (I may upstream it to the sqlx project, as that is what we’re using for db connections.)