@@ -272,12 +272,11 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
272
272
273
273
fn visit_constant ( & mut self , constant : & Constant < ' tcx > , location : Location ) {
274
274
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 ) ;
277
276
278
277
if let Some ( annotation_index) = constant. user_ty {
279
278
if let Err ( terr) = self . cx . relate_type_and_user_type (
280
- constant. ty ,
279
+ constant. literal . ty ,
281
280
ty:: Variance :: Invariant ,
282
281
& UserTypeProjection { base : annotation_index, projs : vec ! [ ] , } ,
283
282
location. to_locations ( ) ,
@@ -289,7 +288,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
289
288
constant,
290
289
"bad constant user type {:?} vs {:?}: {:?}" ,
291
290
annotation,
292
- constant. ty,
291
+ constant. literal . ty,
293
292
terr,
294
293
) ;
295
294
}
@@ -299,7 +298,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
299
298
location. to_locations ( ) ,
300
299
ConstraintCategory :: Boring ,
301
300
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 } ,
303
302
) ) ,
304
303
) {
305
304
span_mirbug ! (
@@ -403,41 +402,6 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
403
402
}
404
403
}
405
404
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
-
441
405
/// Checks that the types internal to the `place` match up with
442
406
/// what would be expected.
443
407
fn sanitize_place (
0 commit comments