dimanche 24 mars 2019

How to write test assuring compilation error?

I want to prove that my API statically prevents its invalid usage by failing to compile.

There is tooling for assuring that code panic on runtime (#[should_panic]), but I couldn't find anything for compilation failure. The doc tests seem most promising, because every snippet is a separate compilation unit, but panic check is all there seems to be.

Aucun commentaire:

Enregistrer un commentaire