@@ -326,12 +326,15 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
326326                ) ; 
327327            } 
328328        }  else  { 
329+             let  tcx = self . tcx ( ) ; 
329330            if  let  ty:: ConstKind :: Unevaluated ( def_id,  substs)  = constant. literal . val  { 
330331                if  let  Err ( terr)  = self . cx . fully_perform_op ( 
331332                    location. to_locations ( ) , 
332333                    ConstraintCategory :: Boring , 
333334                    self . cx . param_env . and ( type_op:: ascribe_user_type:: AscribeUserType :: new ( 
334-                         constant. literal . ty ,  def_id,  UserSubsts  {  substs,  user_self_ty :  None  } , 
335+                         constant. literal . ty , 
336+                         def_id, 
337+                         UserSubsts  {  substs,  user_self_ty :  None  } , 
335338                    ) ) , 
336339                )  { 
337340                    span_mirbug ! ( 
@@ -342,10 +345,22 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
342345                        terr
343346                    ) ; 
344347                } 
348+             }  else  if  let  Some ( static_def_id)  = constant. check_static_ptr ( tcx)  { 
349+                 let  unnormalized_ty = tcx. type_of ( static_def_id) ; 
350+                 let  locations = location. to_locations ( ) ; 
351+                 let  normalized_ty = self . cx . normalize ( unnormalized_ty,  locations) ; 
352+                 let  literal_ty = constant. literal . ty . builtin_deref ( true ) . unwrap ( ) . ty ; 
353+ 
354+                 if  let  Err ( terr)  = self . cx . eq_types ( 
355+                     normalized_ty, 
356+                     literal_ty, 
357+                     locations, 
358+                     ConstraintCategory :: Boring , 
359+                 )  { 
360+                     span_mirbug ! ( self ,  constant,  "bad static type {:?} ({:?})" ,  constant,  terr) ; 
361+                 } 
345362            } 
346363            if  let  ty:: FnDef ( def_id,  substs)  = constant. literal . ty . kind  { 
347-                 let  tcx = self . tcx ( ) ; 
348- 
349364                let  instantiated_predicates = tcx
350365                    . predicates_of ( def_id) 
351366                    . instantiate ( tcx,  substs) ; 
0 commit comments