The definition of Location::caller
states:
pub fn caller() -> &'static Location<'static>`
This is a nightly-only experimental API. (
track_caller
#47809)Returns the source location of the caller of this function. If that function's caller is annotated then its call location will be returned, and so on up the stack to the first call within a non-tracked function body.
That sounds to me like it should return &'static Option<Location<'static>>
.
Anything else seems to make walking the call stack much harder than it could be.
Is there a good reason for this decision?