File tree 1 file changed +19
-7
lines changed
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> {
122
122
where
123
123
D : HasLocalDecls < ' tcx > ,
124
124
{
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 ) ,
132
144
}
133
145
}
134
146
}
You can’t perform that action at this time.
0 commit comments