rust-lang / backtrace-rs

Backtraces in Rust

Home Page:https://docs.rs/backtrace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`trace` should be `unsafe fn(cb: impl FnMut(&Frame) -> ControlFlow)`

workingjubilee opened this issue · comments

The war on bool will continue.

And thus we should use ControlFlow::Break to indicate forward progress should be stopped in backtrace's $(($MAJOR+1)) version.

Obviously this change is somewhat gratuitous, so if anyone has some strong opinions otherwise, I'm listening. However, it's really important for an unsafe interface to be very clear, so...

I do think this make sense to me. trace is indeed just a loop in fancy clothing so ControlFlow is the most correct type, Correctness is important and, as you say, that's especially true in unsafe code.

This may not be the most crucial change in the world but if we're looking at ways to improve the API then this should be one of them.