File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ impl<'tcx> Place<'tcx> {
136
136
let mut place_ty = PlaceTy :: from ( self . base . ty ( local_decls) ) ;
137
137
138
138
// apply .projection_ty() to all elems but only returns the final one.
139
- if !self . elems . is_empty ( ) {
139
+ if !self . has_no_projection ( ) {
140
140
for elem in self . elems . iter ( ) {
141
141
place_ty = place_ty. projection_ty ( tcx, elem) ;
142
142
}
@@ -207,6 +207,10 @@ impl<'tcx> Place<'tcx> {
207
207
}
208
208
}
209
209
210
+ pub fn has_no_projection ( & self ) -> bool {
211
+ self . elems . is_empty ( )
212
+ }
213
+
210
214
// for projection returns the base place;
211
215
// Base.[a, b, c] => Base.[a, b]
212
216
// ^-- projection
@@ -230,7 +234,7 @@ impl<'tcx> Place<'tcx> {
230
234
elem_index : usize ,
231
235
) -> Place < ' tcx > {
232
236
// only works for place with projections
233
- assert ! ( !self . elems . is_empty ( ) ) ;
237
+ assert ! ( !self . has_no_projection ( ) ) ;
234
238
235
239
if elem_index < 1 {
236
240
// Base.[a]
You can’t perform that action at this time.
0 commit comments