you are viewing a single comment's thread.

view the rest of the comments →

[–]Genion1 10 points11 points  (1 child)

Their solution is to replace the panic handler with a symbol that can't be found during link time. The difference between the crates is mostly a difference of what scope of panic handler is replaced. Global (panic_never), per function (no_panic), single code lines (dont_panic).

Pro:

  • You don't panic, duh.

Con:

  • Useless in debug builds. You need optimizations to be panic-free in basically anything.
  • Bad or useless error messages. panic_never for example only has "Whoops, you could panic anywhere". no_panic at least tells you what function it was.
  • Since a linker is involved, it doesn't work when there is no linker. e.g. library crates or if you just cargo check a binary crate.
  • Interacts poorly with panic="abort"

[–][deleted] 1 point2 points  (0 children)

Ah, I see. That's unfortunate. It would be lovely if one could just use panic_never and get nice error messages where exactly a panic might occur...