@@ -250,7 +250,7 @@ impl<'tcx, Prov: Provenance> Frame<'tcx, Prov> {
250
250
impl < ' tcx , Prov : Provenance , Extra > Frame < ' tcx , Prov , Extra > {
251
251
/// Get the current location within the Frame.
252
252
///
253
- /// If this is `Left `, we are not currently executing any particular statement in
253
+ /// If this is `Right `, we are not currently executing any particular statement in
254
254
/// this frame (can happen e.g. during frame initialization, and during unwinding on
255
255
/// frames without cleanup code).
256
256
///
@@ -500,15 +500,18 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
500
500
}
501
501
}
502
502
503
+ /// Returns the span of the currently executed statement/terminator.
504
+ /// This is the span typically used for error reporting.
503
505
#[ inline( always) ]
504
506
pub fn cur_span ( & self ) -> Span {
505
507
// This deliberately does *not* honor `requires_caller_location` since it is used for much
506
508
// more than just panics.
507
509
self . stack ( ) . last ( ) . map_or ( self . tcx . span , |f| f. current_span ( ) )
508
510
}
509
511
512
+ /// Find the first stack frame that is within the current crate, if any;
513
+ /// otherwise return the crate's HirId.
510
514
#[ inline( always) ]
511
- /// Find the first stack frame that is within the current crate, if any, otherwise return the crate's HirId
512
515
pub fn best_lint_scope ( & self ) -> hir:: HirId {
513
516
self . stack ( )
514
517
. iter ( )
@@ -632,7 +635,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
632
635
}
633
636
634
637
/// Walks up the callstack from the intrinsic's callsite, searching for the first callsite in a
635
- /// frame which is not `#[track_caller]`. This is the fancy version of `cur_span`.
638
+ /// frame which is not `#[track_caller]`. This matches the `caller_location` intrinsic,
639
+ /// and is primarily intended for the panic machinery.
636
640
pub ( crate ) fn find_closest_untracked_caller_location ( & self ) -> Span {
637
641
for frame in self . stack ( ) . iter ( ) . rev ( ) {
638
642
debug ! ( "find_closest_untracked_caller_location: checking frame {:?}" , frame. instance) ;
0 commit comments