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:
parent
96c9c60f80
commit
0e41b79a35
@ -32,6 +32,7 @@ impl<T> DebugCheckedUnwrap for Option<T> {
|
|||||||
type Item = T;
|
type Item = T;
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[track_caller]
|
||||||
unsafe fn debug_checked_unwrap(self) -> Self::Item {
|
unsafe fn debug_checked_unwrap(self) -> Self::Item {
|
||||||
if let Some(inner) = self {
|
if let Some(inner) = self {
|
||||||
inner
|
inner
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user