about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-13 11:55:16 +0000
committerbors <bors@rust-lang.org>2024-06-13 11:55:16 +0000
commit9fdbfe1441a82e96e3f99ae199ff5348d8d948ae (patch)
tree66dc4a4d3f9bb3f94fd493d0c5ec8dcc19d3973c /compiler/rustc_const_eval/src
parent921645c737f1d6d107a0a10ca5ee129d364dcd7a (diff)
parentf1a4f30940eb784ff28ccbe66ff72438b614a48b (diff)
Auto merge of #126396 - fmease:rollup-3j7f6wk, r=fmease
Rollup of 6 pull requests

Successful merges:

 - #126347 (Simplify `try_*`'s signature on `Iterator`)
 - #126348 (Improve error message if dependency installation in tidy fails)
 - #126366 (Add a new trait to retrieve StableMir definition Ty)
 - #126370 (compiletest: Stricter parsing of `//@ normalize-*` headers)
 - #126379 (interpret: update doc comment for find_closest_untracked_caller_location)
 - #126384 (add tracking issue for is_none_or)

Failed merges:

 - #126388 (const-eval: make lint scope computation consistent)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/interpret/eval_context.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index ba819853ea0..63572197508 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -250,7 +250,7 @@ impl<'tcx, Prov: Provenance> Frame<'tcx, Prov> {
 impl<'tcx, Prov: Provenance, Extra> Frame<'tcx, Prov, Extra> {
     /// Get the current location within the Frame.
     ///
-    /// If this is `Left`, we are not currently executing any particular statement in
+    /// If this is `Right`, we are not currently executing any particular statement in
     /// this frame (can happen e.g. during frame initialization, and during unwinding on
     /// frames without cleanup code).
     ///
@@ -500,6 +500,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
         }
     }
 
+    /// Returns the span of the currently executed statement/terminator.
+    /// This is the span typically used for error reporting.
     #[inline(always)]
     pub fn cur_span(&self) -> Span {
         // This deliberately does *not* honor `requires_caller_location` since it is used for much
@@ -507,8 +509,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
         self.stack().last().map_or(self.tcx.span, |f| f.current_span())
     }
 
+    /// Find the first stack frame that is within the current crate, if any;
+    /// otherwise return the crate's HirId.
     #[inline(always)]
-    /// Find the first stack frame that is within the current crate, if any, otherwise return the crate's HirId
     pub fn best_lint_scope(&self) -> hir::HirId {
         self.stack()
             .iter()
@@ -632,7 +635,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
     }
 
     /// Walks up the callstack from the intrinsic's callsite, searching for the first callsite in a
-    /// frame which is not `#[track_caller]`. This is the fancy version of `cur_span`.
+    /// frame which is not `#[track_caller]`. This matches the `caller_location` intrinsic,
+    /// and is primarily intended for the panic machinery.
     pub(crate) fn find_closest_untracked_caller_location(&self) -> Span {
         for frame in self.stack().iter().rev() {
             debug!("find_closest_untracked_caller_location: checking frame {:?}", frame.instance);