What would it take to add refinement types to Rust?

A few years ago, I created YAIOUOM, a static analyzer for Rust that ensured the correct use of units of measure in code. This refinement type system was surprisingly easy to write but could only work on a specific version of Rust Nightly. Unfortunately, Rust lacks the ability to specify certain type equivalence, hindering advanced functionality like improved error messages for complex programming. To address this limitation, expanding the Rust type system by introducing an extension to handle unit equivalences could enhance the language’s capabilities. Despite the potential, implementing such features requires further development and exploration.

https://yoric.github.io/post/rust-refinement-types/

To top