@@ -562,23 +562,23 @@ where
562
562
563
563
/// Evaluate statics and promoteds to an `MPlace`. Used to share some code between
564
564
/// `eval_place` and `eval_place_to_op`.
565
- pub ( super ) fn eval_place_to_mplace (
565
+ pub ( super ) fn eval_static_to_mplace (
566
566
& self ,
567
- mir_place : & mir:: Place < ' tcx >
567
+ place_static : & mir:: Static < ' tcx >
568
568
) -> EvalResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
569
- use rustc:: mir:: Place :: * ;
570
- use rustc:: mir:: PlaceBase ;
571
- use rustc:: mir:: { Static , StaticKind } ;
572
- Ok ( match * mir_place {
573
- Base ( PlaceBase :: Static ( box Static { kind : StaticKind :: Promoted ( promoted) , .. } ) ) => {
569
+ use rustc:: mir:: StaticKind ;
570
+
571
+ Ok ( match place_static. kind {
572
+ StaticKind :: Promoted ( promoted) => {
574
573
let instance = self . frame ( ) . instance ;
575
574
self . const_eval_raw ( GlobalId {
576
575
instance,
577
576
promoted : Some ( promoted) ,
578
577
} ) ?
579
578
}
580
579
581
- Base ( PlaceBase :: Static ( box Static { kind : StaticKind :: Static ( def_id) , ty } ) ) => {
580
+ StaticKind :: Static ( def_id) => {
581
+ let ty = place_static. ty ;
582
582
assert ! ( !ty. needs_subst( ) ) ;
583
583
let layout = self . layout_of ( ty) ?;
584
584
let instance = ty:: Instance :: mono ( * self . tcx , def_id) ;
@@ -600,8 +600,6 @@ where
600
600
let alloc = self . tcx . alloc_map . lock ( ) . intern_static ( cid. instance . def_id ( ) ) ;
601
601
MPlaceTy :: from_aligned_ptr ( Pointer :: from ( alloc) . with_default_tag ( ) , layout)
602
602
}
603
-
604
- _ => bug ! ( "eval_place_to_mplace called on {:?}" , mir_place) ,
605
603
} )
606
604
}
607
605
@@ -613,7 +611,7 @@ where
613
611
) -> EvalResult < ' tcx , PlaceTy < ' tcx , M :: PointerTag > > {
614
612
use rustc:: mir:: Place :: * ;
615
613
use rustc:: mir:: PlaceBase ;
616
- let place = match * mir_place {
614
+ let place = match mir_place {
617
615
Base ( PlaceBase :: Local ( mir:: RETURN_PLACE ) ) => match self . frame ( ) . return_place {
618
616
Some ( return_place) =>
619
617
// We use our layout to verify our assumption; caller will validate
@@ -628,17 +626,19 @@ where
628
626
// This works even for dead/uninitialized locals; we check further when writing
629
627
place : Place :: Local {
630
628
frame : self . cur_frame ( ) ,
631
- local,
629
+ local : * local ,
632
630
} ,
633
- layout : self . layout_of_local ( self . frame ( ) , local, None ) ?,
631
+ layout : self . layout_of_local ( self . frame ( ) , * local, None ) ?,
634
632
} ,
635
633
636
- Projection ( ref proj) => {
634
+ Projection ( proj) => {
637
635
let place = self . eval_place ( & proj. base ) ?;
638
636
self . place_projection ( place, & proj. elem ) ?
639
637
}
640
638
641
- _ => self . eval_place_to_mplace ( mir_place) ?. into ( ) ,
639
+ Base ( PlaceBase :: Static ( place_static) ) => {
640
+ self . eval_static_to_mplace ( place_static) ?. into ( )
641
+ }
642
642
} ;
643
643
644
644
self . dump_place ( place. place ) ;
0 commit comments