Skip to content

Commit 632a895

Browse files
committed
Add a getter for Frame.loc
This is necessary for Priroda.
1 parent ec7f8d9 commit 632a895

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compiler/rustc_mir/src/interpret/eval_context.rs

+10
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ impl<'mir, 'tcx, Tag> Frame<'mir, 'tcx, Tag> {
226226
}
227227

228228
impl<'mir, 'tcx, Tag, Extra> Frame<'mir, 'tcx, Tag, Extra> {
229+
/// Get the current location within the Frame.
230+
///
231+
/// If this is `Err`, we are not currently executing any particular statement in
232+
/// this frame (can happen e.g. during frame initialization, and during unwinding on
233+
/// frames without cleanup code).
234+
/// We basically abuse `Result` as `Either`.
235+
pub fn current_loc(&self) -> Result<mir::Location, Span> {
236+
self.loc
237+
}
238+
229239
/// Return the `SourceInfo` of the current instruction.
230240
pub fn current_source_info(&self) -> Option<&mir::SourceInfo> {
231241
self.loc.ok().map(|loc| self.body.source_info(loc))

0 commit comments

Comments
 (0)