rust-lang / backtrace-rs

Backtraces in Rust
https://docs.rs/backtrace
Other
532 stars 245 forks source link

Reduce panics in dbghelp #608

Closed ChrisDenton closed 5 months ago

ChrisDenton commented 6 months ago

According to the docs for resolve:

The closure may not be called if resolution could not be performed This function strives to never panic.

So we should ideally not panic and instead simply return without calling the closure. Therefore, I've changed the panicky FFI calls to instead simply return.

I also replaced our custom UTF-16 to UTF-8 converter with a call to WideCharToMultiByte. This function already has the semantics we want and doesn't include panicking code.

These changes should have a small but notable effect on binary size.

github-actions[bot] commented 6 months ago

Code size changes for a hello-world Rust program linked with libstd with backtrace:

On platform windows-latest: