4 ms·
what about a linter for Rust which highlights functions that may panic so you can avoid them? It seems like a fun project and useful feature Unless I’m mistake
by armchairhacker 4y ago
what about a linter for Rust which highlights functions that may panic so you can avoid them? It seems like a fun project and useful feature
Unless I’m mistaken, in “safe” Rust, programs can still crash but only by calling “panic”, or other trivial cases (explicitly calling “exit” with a nonzero return value, calling into ffi code, etc)
Detecting functions which may “panic” and “exit” is very easy, significantly easier than detecting possible UB. Avoiding these functions (or providing a comment “no-panic guarantee” like “safety guarantee” for unsafe Rust) doesn’t seem very hard, since lots of panicking functions have a non-panicking variant.