@@ -357,12 +357,20 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
357
357
. add_element ( live_region_vid, location) ;
358
358
} ) ;
359
359
360
+ // HACK(compiler-errors): Constants that are gathered into Body.required_consts
361
+ // have their locations erased...
362
+ let locations = if location != Location :: START {
363
+ location. to_locations ( )
364
+ } else {
365
+ Locations :: All ( constant. span )
366
+ } ;
367
+
360
368
if let Some ( annotation_index) = constant. user_ty {
361
369
if let Err ( terr) = self . cx . relate_type_and_user_type (
362
370
constant. literal . ty ( ) ,
363
371
ty:: Variance :: Invariant ,
364
372
& UserTypeProjection { base : annotation_index, projs : vec ! [ ] } ,
365
- location . to_locations ( ) ,
373
+ locations ,
366
374
ConstraintCategory :: Boring ,
367
375
) {
368
376
let annotation = & self . cx . user_type_annotations [ annotation_index] ;
@@ -390,12 +398,9 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
390
398
promoted : & Body < ' tcx > ,
391
399
ty,
392
400
san_ty| {
393
- if let Err ( terr) = verifier. cx . eq_types (
394
- ty,
395
- san_ty,
396
- location. to_locations ( ) ,
397
- ConstraintCategory :: Boring ,
398
- ) {
401
+ if let Err ( terr) =
402
+ verifier. cx . eq_types ( ty, san_ty, locations, ConstraintCategory :: Boring )
403
+ {
399
404
span_mirbug ! (
400
405
verifier,
401
406
promoted,
@@ -416,7 +421,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
416
421
}
417
422
} else {
418
423
if let Err ( terr) = self . cx . fully_perform_op (
419
- location . to_locations ( ) ,
424
+ locations ,
420
425
ConstraintCategory :: Boring ,
421
426
self . cx . param_env . and ( type_op:: ascribe_user_type:: AscribeUserType :: new (
422
427
constant. literal . ty ( ) ,
@@ -435,7 +440,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
435
440
}
436
441
} else if let Some ( static_def_id) = constant. check_static_ptr ( tcx) {
437
442
let unnormalized_ty = tcx. type_of ( static_def_id) ;
438
- let locations = location. to_locations ( ) ;
439
443
let normalized_ty = self . cx . normalize ( unnormalized_ty, locations) ;
440
444
let literal_ty = constant. literal . ty ( ) . builtin_deref ( true ) . unwrap ( ) . ty ;
441
445
@@ -454,7 +458,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
454
458
self . cx . normalize_and_prove_instantiated_predicates (
455
459
def_id,
456
460
instantiated_predicates,
457
- location . to_locations ( ) ,
461
+ locations ,
458
462
) ;
459
463
}
460
464
}
0 commit comments