@@ -104,12 +104,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> {
104104 }
105105 }
106106
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 ) {
113108 self . sanitize_place ( place, location, context) ;
114109 }
115110
@@ -164,11 +159,12 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
164159 }
165160 }
166161
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 > {
172168 debug ! ( "sanitize_place: {:?}" , place) ;
173169 let place_ty = match * place {
174170 Place :: Local ( index) => PlaceTy :: Ty {
@@ -210,9 +206,11 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
210206 } ;
211207 if let PlaceContext :: Copy = context {
212208 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) ;
216214 }
217215 }
218216 place_ty
@@ -312,18 +310,16 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
312310 ProjectionElem :: Field ( field, fty) => {
313311 let fty = self . sanitize_type ( place, fty) ;
314312 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+ } ,
327323 Err ( FieldAccessError :: OutOfRange { field_count } ) => span_mirbug ! (
328324 self ,
329325 place,
@@ -358,9 +354,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
358354 variant_index,
359355 } => ( & adt_def. variants [ variant_index] , substs) ,
360356 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) ,
364358 ty:: TyClosure ( def_id, substs) => {
365359 return match substs. upvar_tys ( def_id, tcx) . nth ( field. index ( ) ) {
366360 Some ( ty) => Ok ( ty) ,
0 commit comments