@@ -272,12 +272,11 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
272272
273273 fn visit_constant ( & mut self , constant : & Constant < ' tcx > , location : Location ) {
274274 self . super_constant ( constant, location) ;
275- self . sanitize_constant ( constant, location) ;
276- self . sanitize_type ( constant, constant. ty ) ;
275+ self . sanitize_type ( constant, constant. literal . ty ) ;
277276
278277 if let Some ( annotation_index) = constant. user_ty {
279278 if let Err ( terr) = self . cx . relate_type_and_user_type (
280- constant. ty ,
279+ constant. literal . ty ,
281280 ty:: Variance :: Invariant ,
282281 & UserTypeProjection { base : annotation_index, projs : vec ! [ ] , } ,
283282 location. to_locations ( ) ,
@@ -289,7 +288,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
289288 constant,
290289 "bad constant user type {:?} vs {:?}: {:?}" ,
291290 annotation,
292- constant. ty,
291+ constant. literal . ty,
293292 terr,
294293 ) ;
295294 }
@@ -299,7 +298,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
299298 location. to_locations ( ) ,
300299 ConstraintCategory :: Boring ,
301300 self . cx . param_env . and ( type_op:: ascribe_user_type:: AscribeUserType :: new (
302- constant. ty , def_id, UserSubsts { substs, user_self_ty : None } ,
301+ constant. literal . ty , def_id, UserSubsts { substs, user_self_ty : None } ,
303302 ) ) ,
304303 ) {
305304 span_mirbug ! (
@@ -403,41 +402,6 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
403402 }
404403 }
405404
406- /// Checks that the constant's `ty` field matches up with what would be
407- /// expected from its literal. Unevaluated constants and well-formed
408- /// constraints are checked by `visit_constant`.
409- fn sanitize_constant ( & mut self , constant : & Constant < ' tcx > , location : Location ) {
410- debug ! (
411- "sanitize_constant(constant={:?}, location={:?})" ,
412- constant, location
413- ) ;
414-
415- let literal = constant. literal ;
416-
417- if let ConstValue :: Unevaluated ( ..) = literal. val {
418- return ;
419- }
420-
421- debug ! ( "sanitize_constant: expected_ty={:?}" , literal. ty) ;
422-
423- if let Err ( terr) = self . cx . eq_types (
424- literal. ty ,
425- constant. ty ,
426- location. to_locations ( ) ,
427- ConstraintCategory :: Boring ,
428- ) {
429- span_mirbug ! (
430- self ,
431- constant,
432- "constant {:?} should have type {:?} but has {:?} ({:?})" ,
433- constant,
434- literal. ty,
435- constant. ty,
436- terr,
437- ) ;
438- }
439- }
440-
441405 /// Checks that the types internal to the `place` match up with
442406 /// what would be expected.
443407 fn sanitize_place (
0 commit comments