@@ -182,16 +182,17 @@ trait Qualif {
182
182
183
183
fn in_projection_structurally (
184
184
cx : & ConstCx < ' _ , ' tcx > ,
185
- base : & PlaceBase < ' tcx > ,
186
- proj : & Projection < ' tcx > ,
185
+ place : PlaceRef < ' _ , ' tcx > ,
187
186
) -> bool {
187
+ let proj = place. projection . as_ref ( ) . unwrap ( ) ;
188
+
188
189
let base_qualif = Self :: in_place ( cx, PlaceRef {
189
- base,
190
+ base : place . base ,
190
191
projection : & proj. base ,
191
192
} ) ;
192
193
let qualif = base_qualif && Self :: mask_for_ty (
193
194
cx,
194
- Place :: ty_from ( & base, & proj. base , cx. body , cx. tcx )
195
+ Place :: ty_from ( place . base , & proj. base , cx. body , cx. tcx )
195
196
. projection_ty ( cx. tcx , & proj. elem )
196
197
. ty ,
197
198
) ;
@@ -208,10 +209,9 @@ trait Qualif {
208
209
209
210
fn in_projection (
210
211
cx : & ConstCx < ' _ , ' tcx > ,
211
- base : & PlaceBase < ' tcx > ,
212
- proj : & Projection < ' tcx > ,
212
+ place : PlaceRef < ' _ , ' tcx > ,
213
213
) -> bool {
214
- Self :: in_projection_structurally ( cx, base , proj )
214
+ Self :: in_projection_structurally ( cx, place )
215
215
}
216
216
217
217
fn in_place ( cx : & ConstCx < ' _ , ' tcx > , place : PlaceRef < ' _ , ' tcx > ) -> bool {
@@ -234,9 +234,9 @@ trait Qualif {
234
234
Self :: in_static ( cx, static_)
235
235
} ,
236
236
PlaceRef {
237
- base,
238
- projection : Some ( proj ) ,
239
- } => Self :: in_projection ( cx, base , proj ) ,
237
+ base : _ ,
238
+ projection : Some ( _ ) ,
239
+ } => Self :: in_projection ( cx, place ) ,
240
240
}
241
241
}
242
242
@@ -448,9 +448,10 @@ impl Qualif for IsNotPromotable {
448
448
449
449
fn in_projection (
450
450
cx : & ConstCx < ' _ , ' tcx > ,
451
- base : & PlaceBase < ' tcx > ,
452
- proj : & Projection < ' tcx > ,
451
+ place : PlaceRef < ' _ , ' tcx > ,
453
452
) -> bool {
453
+ let proj = place. projection . as_ref ( ) . unwrap ( ) ;
454
+
454
455
match proj. elem {
455
456
ProjectionElem :: Deref |
456
457
ProjectionElem :: Downcast ( ..) => return true ,
@@ -461,7 +462,7 @@ impl Qualif for IsNotPromotable {
461
462
462
463
ProjectionElem :: Field ( ..) => {
463
464
if cx. mode == Mode :: NonConstFn {
464
- let base_ty = Place :: ty_from ( base, & proj. base , cx. body , cx. tcx ) . ty ;
465
+ let base_ty = Place :: ty_from ( place . base , & proj. base , cx. body , cx. tcx ) . ty ;
465
466
if let Some ( def) = base_ty. ty_adt_def ( ) {
466
467
// No promotion of union field accesses.
467
468
if def. is_union ( ) {
@@ -472,7 +473,7 @@ impl Qualif for IsNotPromotable {
472
473
}
473
474
}
474
475
475
- Self :: in_projection_structurally ( cx, base , proj )
476
+ Self :: in_projection_structurally ( cx, place )
476
477
}
477
478
478
479
fn in_rvalue ( cx : & ConstCx < ' _ , ' tcx > , rvalue : & Rvalue < ' tcx > ) -> bool {
0 commit comments