@@ -607,42 +607,42 @@ where
607
607
/// place; for reading, a more efficient alternative is `eval_place_for_read`.
608
608
pub fn eval_place (
609
609
& mut self ,
610
- mir_place : & mir:: Place < ' tcx >
610
+ mir_place : & mir:: Place < ' tcx > ,
611
611
) -> EvalResult < ' tcx , PlaceTy < ' tcx , M :: PointerTag > > {
612
- use rustc:: mir:: Place :: * ;
613
612
use rustc:: mir:: PlaceBase ;
614
- let place = match mir_place {
615
- Base ( PlaceBase :: Local ( mir:: RETURN_PLACE ) ) => match self . frame ( ) . return_place {
616
- Some ( return_place) =>
617
- // We use our layout to verify our assumption; caller will validate
618
- // their layout on return.
619
- PlaceTy {
620
- place : * return_place,
621
- layout : self . layout_of ( self . monomorphize ( self . frame ( ) . mir . return_ty ( ) ) ?) ?,
613
+
614
+ mir_place. iterate ( |place_base, place_projection| {
615
+ let mut place = match place_base {
616
+ PlaceBase :: Local ( mir:: RETURN_PLACE ) => match self . frame ( ) . return_place {
617
+ Some ( return_place) => {
618
+ // We use our layout to verify our assumption; caller will validate
619
+ // their layout on return.
620
+ PlaceTy {
621
+ place : * return_place,
622
+ layout : self
623
+ . layout_of ( self . monomorphize ( self . frame ( ) . mir . return_ty ( ) ) ?) ?,
624
+ }
625
+ }
626
+ None => return err ! ( InvalidNullPointerUsage ) ,
627
+ } ,
628
+ PlaceBase :: Local ( local) => PlaceTy {
629
+ // This works even for dead/uninitialized locals; we check further when writing
630
+ place : Place :: Local {
631
+ frame : self . cur_frame ( ) ,
632
+ local : * local,
622
633
} ,
623
- None => return err ! ( InvalidNullPointerUsage ) ,
624
- } ,
625
- Base ( PlaceBase :: Local ( local) ) => PlaceTy {
626
- // This works even for dead/uninitialized locals; we check further when writing
627
- place : Place :: Local {
628
- frame : self . cur_frame ( ) ,
629
- local : * local,
634
+ layout : self . layout_of_local ( self . frame ( ) , * local, None ) ?,
630
635
} ,
631
- layout : self . layout_of_local ( self . frame ( ) , * local, None ) ?,
632
- } ,
633
-
634
- Projection ( proj) => {
635
- let place = self . eval_place ( & proj. base ) ?;
636
- self . place_projection ( place, & proj. elem ) ?
637
- }
636
+ PlaceBase :: Static ( place_static) => self . eval_static_to_mplace ( place_static) ?. into ( ) ,
637
+ } ;
638
638
639
- Base ( PlaceBase :: Static ( place_static ) ) => {
640
- self . eval_static_to_mplace ( place_static ) ? . into ( )
639
+ for proj in place_projection {
640
+ place = self . place_projection ( place , & proj . elem ) ?
641
641
}
642
- } ;
643
642
644
- self . dump_place ( place. place ) ;
645
- Ok ( place)
643
+ self . dump_place ( place. place ) ;
644
+ Ok ( place)
645
+ } )
646
646
}
647
647
648
648
/// Write a scalar to a place
0 commit comments