@@ -104,12 +104,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> {
104
104
}
105
105
}
106
106
107
- fn visit_place (
108
- & mut self ,
109
- place : & Place < ' tcx > ,
110
- context : PlaceContext ,
111
- location : Location ,
112
- ) {
107
+ fn visit_place ( & mut self , place : & Place < ' tcx > , context : PlaceContext , location : Location ) {
113
108
self . sanitize_place ( place, location, context) ;
114
109
}
115
110
@@ -164,11 +159,12 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
164
159
}
165
160
}
166
161
167
- fn sanitize_place ( & mut self ,
168
- place : & Place < ' tcx > ,
169
- location : Location ,
170
- context : PlaceContext )
171
- -> PlaceTy < ' tcx > {
162
+ fn sanitize_place (
163
+ & mut self ,
164
+ place : & Place < ' tcx > ,
165
+ location : Location ,
166
+ context : PlaceContext ,
167
+ ) -> PlaceTy < ' tcx > {
172
168
debug ! ( "sanitize_place: {:?}" , place) ;
173
169
let place_ty = match * place {
174
170
Place :: Local ( index) => PlaceTy :: Ty {
@@ -210,9 +206,11 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
210
206
} ;
211
207
if let PlaceContext :: Copy = context {
212
208
let ty = place_ty. to_ty ( self . tcx ( ) ) ;
213
- if self . cx . infcx . type_moves_by_default ( self . cx . param_env , ty, DUMMY_SP ) {
214
- span_mirbug ! ( self , place,
215
- "attempted copy of non-Copy type ({:?})" , ty) ;
209
+ if self . cx
210
+ . infcx
211
+ . type_moves_by_default ( self . cx . param_env , ty, DUMMY_SP )
212
+ {
213
+ span_mirbug ! ( self , place, "attempted copy of non-Copy type ({:?})" , ty) ;
216
214
}
217
215
}
218
216
place_ty
@@ -312,18 +310,16 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
312
310
ProjectionElem :: Field ( field, fty) => {
313
311
let fty = self . sanitize_type ( place, fty) ;
314
312
match self . field_ty ( place, base, field, location) {
315
- Ok ( ty) => {
316
- if let Err ( terr) = self . cx . eq_types ( ty, fty, location. at_self ( ) ) {
317
- span_mirbug ! (
318
- self ,
319
- place,
320
- "bad field access ({:?}: {:?}): {:?}" ,
321
- ty,
322
- fty,
323
- terr
324
- ) ;
325
- }
326
- }
313
+ Ok ( ty) => if let Err ( terr) = self . cx . eq_types ( ty, fty, location. at_self ( ) ) {
314
+ span_mirbug ! (
315
+ self ,
316
+ place,
317
+ "bad field access ({:?}: {:?}): {:?}" ,
318
+ ty,
319
+ fty,
320
+ terr
321
+ ) ;
322
+ } ,
327
323
Err ( FieldAccessError :: OutOfRange { field_count } ) => span_mirbug ! (
328
324
self ,
329
325
place,
@@ -358,9 +354,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
358
354
variant_index,
359
355
} => ( & adt_def. variants [ variant_index] , substs) ,
360
356
PlaceTy :: Ty { ty } => match ty. sty {
361
- ty:: TyAdt ( adt_def, substs) if !adt_def. is_enum ( ) => {
362
- ( & adt_def. variants [ 0 ] , substs)
363
- }
357
+ ty:: TyAdt ( adt_def, substs) if !adt_def. is_enum ( ) => ( & adt_def. variants [ 0 ] , substs) ,
364
358
ty:: TyClosure ( def_id, substs) => {
365
359
return match substs. upvar_tys ( def_id, tcx) . nth ( field. index ( ) ) {
366
360
Some ( ty) => Ok ( ty) ,
0 commit comments