Similar to what Daniel said, I don't think this works nicely unless all
possible calls to foo are enclosed with this keyword. The code for enforce!
would be part of foo, and called from multiple locations.  If some disable
it and some don't, then what?

In general, I'd be against allowing disabling of something like
'enforce!'.  The whole point of using such a macro would be to say "Never
let this be false.  If it is, fail so that it can't cause bigger problems".
Your 'bugprone' keyword removes the certainty this offers.

In general, I think safety enforced within a function should not be
removable by callers of said function.  Basically, that makes coding those
safety assurances useless.  If you want the checks to be removable, use
assert.

- Brandon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to