debug_checked_unwrap should track its caller (#6452)

# Objective

When an error causes `debug_checked_unreachable` to be called, the panic message unhelpfully points to the function definition instead of the place that caused the error.

## Solution

Add the `#[track_caller]` attribute in debug mode.
This commit is contained in:
JoJoJet 2022-11-05 16:15:08 +00:00
parent 96c9c60f80
commit 0e41b79a35

View file

@ -32,6 +32,7 @@ impl<T> DebugCheckedUnwrap for Option<T> {
type Item = T;
#[inline(always)]
#[track_caller]
unsafe fn debug_checked_unwrap(self) -> Self::Item {
if let Some(inner) = self {
inner