File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -122,13 +122,25 @@ impl<'tcx> Place<'tcx> {
122122 where
123123 D : HasLocalDecls < ' tcx > ,
124124 {
125- match * self {
126- Place :: Base ( PlaceBase :: Local ( index) ) =>
127- PlaceTy :: from_ty ( local_decls. local_decls ( ) [ index] . ty ) ,
128- Place :: Base ( PlaceBase :: Static ( ref data) ) =>
129- PlaceTy :: from_ty ( data. ty ) ,
130- Place :: Projection ( ref proj) =>
131- proj. base . ty ( local_decls, tcx) . projection_ty ( tcx, & proj. elem ) ,
125+ self . iterate ( |place_base, place_projections| {
126+ let mut place_ty = place_base. ty ( local_decls) ;
127+
128+ for proj in place_projections {
129+ place_ty = place_ty. projection_ty ( tcx, & proj. elem ) ;
130+ }
131+
132+ place_ty
133+ } )
134+ }
135+ }
136+
137+ impl < ' tcx > PlaceBase < ' tcx > {
138+ pub fn ty < D > ( & self , local_decls : & D ) -> PlaceTy < ' tcx >
139+ where D : HasLocalDecls < ' tcx >
140+ {
141+ match self {
142+ PlaceBase :: Local ( index) => PlaceTy :: from_ty ( local_decls. local_decls ( ) [ * index] . ty ) ,
143+ PlaceBase :: Static ( data) => PlaceTy :: from_ty ( data. ty ) ,
132144 }
133145 }
134146}
You can’t perform that action at this time.
0 commit comments