This is definitely in the department of blue-sky, out-there projects, but I was just thinking about option::get and wondering how feasible it would be to adapt the ideas in Neil Mitchell's Catch tool (for Haskell) to Rust.
http://community.haskell.org/~ndm/catch/
In our case, this would be to verify that alt check, and maybe even functions that pattern-match on their input and unconditionally fail in one or more branches (like option::get) are being used safely (which is to say, in a way that won't cause a runtime failure). This would be one way to allow alt checks and get a safety guarantee.
Mutability would definitely complicate things, but one way out is to only provide any guarantees about immutable data (and warn in a lint pass about alt check and similar things on mutable data).
This is definitely in the department of blue-sky, out-there projects, but I was just thinking about
option::getand wondering how feasible it would be to adapt the ideas in Neil Mitchell's Catch tool (for Haskell) to Rust.http://community.haskell.org/~ndm/catch/
In our case, this would be to verify that
alt check, and maybe even functions that pattern-match on their input and unconditionally fail in one or more branches (likeoption::get) are being used safely (which is to say, in a way that won't cause a runtime failure). This would be one way to allowalt checks and get a safety guarantee.Mutability would definitely complicate things, but one way out is to only provide any guarantees about immutable data (and warn in a lint pass about
alt checkand similar things on mutable data).