rust-lang / backtrace-rs

Backtraces in Rust
https://docs.rs/backtrace
Other
516 stars 237 forks source link

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

Open workingjubilee opened 3 months ago

workingjubilee commented 3 months ago

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.

workingjubilee commented 3 months ago

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...

ChrisDenton commented 3 months ago

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.