Skip to content

Commit 92d2eb8

Browse files
authored
Unrolled build for rust-lang#126379
Rollup merge of rust-lang#126379 - RalfJung:find_closest_untracked_caller_location, r=oli-obk interpret: update doc comment for find_closest_untracked_caller_location Also add a doc comment to cur_span. r? `@compiler-errors`
2 parents 921645c + d87ec03 commit 92d2eb8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

compiler/rustc_const_eval/src/interpret/eval_context.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'tcx, Prov: Provenance> Frame<'tcx, Prov> {
250250
impl<'tcx, Prov: Provenance, Extra> Frame<'tcx, Prov, Extra> {
251251
/// Get the current location within the Frame.
252252
///
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
254254
/// this frame (can happen e.g. during frame initialization, and during unwinding on
255255
/// frames without cleanup code).
256256
///
@@ -500,15 +500,18 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
500500
}
501501
}
502502

503+
/// Returns the span of the currently executed statement/terminator.
504+
/// This is the span typically used for error reporting.
503505
#[inline(always)]
504506
pub fn cur_span(&self) -> Span {
505507
// This deliberately does *not* honor `requires_caller_location` since it is used for much
506508
// more than just panics.
507509
self.stack().last().map_or(self.tcx.span, |f| f.current_span())
508510
}
509511

512+
/// Find the first stack frame that is within the current crate, if any;
513+
/// otherwise return the crate's HirId.
510514
#[inline(always)]
511-
/// Find the first stack frame that is within the current crate, if any, otherwise return the crate's HirId
512515
pub fn best_lint_scope(&self) -> hir::HirId {
513516
self.stack()
514517
.iter()
@@ -632,7 +635,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
632635
}
633636

634637
/// 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.
636640
pub(crate) fn find_closest_untracked_caller_location(&self) -> Span {
637641
for frame in self.stack().iter().rev() {
638642
debug!("find_closest_untracked_caller_location: checking frame {:?}", frame.instance);

0 commit comments

Comments
 (0)