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