Support finding uses of panic!
Opened this issue · 2 comments
One thing which would really complement the ability to list uses of unsafe
for auditing purposes is the ability to also list code which can panic!
.
Having a more reliable way to check that I've cleaned up any "make it work, then make it perfect" hacks than grepping for everything I remember being able to panic (unwrap()
, unimplemented!
, []
, etc.) would really help to push forward both the "fearless" and "reliable" aspects of Rust.
(Essentially, I want to make sure my rapid prototyping phases don't leave any panics lying around in places which the release code actually can allow recovery from... and situations where harbor has a better memory for what builtins panic than I do.)
Naturally, it should also have a way for me to whitelist things to avoid noise, but such a capability could also be useful in an integration testing system if un-whitelisted panics were considered problematic.
Now, obviously, there are a lot of things that can panic transitively (eg. anything in std
that can allocate), so some thought would need to go into the default behaviour.
I'd suggest designing a default behaviour based on some sort of "reasonable to possibly avoid" metric (eg. []
has a non-panicking alternative, unreachable!
and panic!
should be audited and whitelisted, unimplemented!
should be replaced with an implementation, etc.)
As I thought, I don't have permission to label this as a feature request.
honestly, i think finding panics is even more important then finding unsafe, because uses of unsafe are generally well planed, while .unwrap() is often just lazyness/hope this won't crash/will do this later.