#[no_panic] --> #[no_panic_if(cond)]#1387
Conversation
|
It's still not 100% clear to me why this is on the critical path to checking closures/traits with One thing me and Evan chatted about today was that this could empower users to have a more ergonomic interface for Flux: this allows us to say something like "scream at the user if they care about one specific flavor of checks, otherwise don't care." That seems a bit orthogonal to checking traits, though -- I think I'm forgetting the motivation behind this change! To be clear: I don't have any specific concerns. I just forget why this is the next step! Edit: oh, it's because this is |
Co-authored-by: Nico Lehmann <nico.lehmannm@gmail.com>
Co-authored-by: Nico Lehmann <nico.lehmannm@gmail.com>
|
Thanks for the help @nilehmann!! Ready for more comments :) |
|
@ninehusky, I fixed some details and merged your changes in #1492 |
Implements conditional panics, which is the starter step for us to target things like
no_panicon traits/closures/etc.The rough implementation roadmap in my head:
no_panicattribute so that it's accompanied with anExprdescribing some condition.no_panicwithout an expr desugars tono_panic_if(true).no_panic_if(cond), then append that as a precondition. e.g., if I have some function which requireslen > 0, and ano_panicspec sayingidx < len, then the precondition to prove islen > 0 && idx < len.EDIT: Freezing this for now so that we can work on the more specific solution of marking closures as
no_panic. We can come back to this later.