@@ -13,9 +13,9 @@ use rustc_middle::{mir, ty};
13
13
use rustc_target:: abi:: { self , Abi , HasDataLayout , Size } ;
14
14
15
15
use super :: {
16
- alloc_range, from_known_layout, mir_assign_valid_types, CtfeProvenance , Frame , InterpCx ,
17
- InterpResult , MPlaceTy , Machine , MemPlace , MemPlaceMeta , OffsetMode , PlaceTy , Pointer ,
18
- Projectable , Provenance , Scalar ,
16
+ alloc_range, from_known_layout, mir_assign_valid_types, CtfeProvenance , InterpCx , InterpResult ,
17
+ MPlaceTy , Machine , MemPlace , MemPlaceMeta , OffsetMode , PlaceTy , Pointer , Projectable ,
18
+ Provenance , Scalar ,
19
19
} ;
20
20
21
21
/// An `Immediate` represents a single immediate self-contained Rust value.
@@ -633,17 +633,17 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
633
633
}
634
634
}
635
635
636
- /// Read from a local.
636
+ /// Read from a local of the current frame .
637
637
/// Will not access memory, instead an indirect `Operand` is returned.
638
638
///
639
639
/// This is public because it is used by [priroda](https://github.com/oli-obk/priroda) to get an
640
640
/// OpTy from a local.
641
641
pub fn local_to_op (
642
642
& self ,
643
- frame : & Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > ,
644
643
local : mir:: Local ,
645
644
layout : Option < TyAndLayout < ' tcx > > ,
646
645
) -> InterpResult < ' tcx , OpTy < ' tcx , M :: Provenance > > {
646
+ let frame = self . frame ( ) ;
647
647
let layout = self . layout_of_local ( frame, local, layout) ?;
648
648
let op = * frame. locals [ local] . access ( ) ?;
649
649
if matches ! ( op, Operand :: Immediate ( _) ) {
@@ -664,7 +664,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
664
664
Right ( ( local, offset, locals_addr) ) => {
665
665
debug_assert ! ( place. layout. is_sized( ) ) ; // only sized locals can ever be `Place::Local`.
666
666
debug_assert_eq ! ( locals_addr, self . frame( ) . locals_addr( ) ) ;
667
- let base = self . local_to_op ( & self . frame ( ) , local, None ) ?;
667
+ let base = self . local_to_op ( local, None ) ?;
668
668
Ok ( match offset {
669
669
Some ( offset) => base. offset ( offset, place. layout , self ) ?,
670
670
None => {
@@ -688,7 +688,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
688
688
// here is not the entire place.
689
689
let layout = if mir_place. projection . is_empty ( ) { layout } else { None } ;
690
690
691
- let mut op = self . local_to_op ( self . frame ( ) , mir_place. local , layout) ?;
691
+ let mut op = self . local_to_op ( mir_place. local , layout) ?;
692
692
// Using `try_fold` turned out to be bad for performance, hence the loop.
693
693
for elem in mir_place. projection . iter ( ) {
694
694
op = self . project ( & op, elem) ?
0 commit comments