@@ -587,6 +587,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
587587 // modify their locations.
588588 let all_facts = & mut None ;
589589 let mut constraints = Default :: default ( ) ;
590+ let mut type_tests = Default :: default ( ) ;
590591 let mut closure_bounds = Default :: default ( ) ;
591592 let mut liveness_constraints =
592593 LivenessValues :: new ( Rc :: new ( RegionValueElements :: new ( & promoted_body) ) ) ;
@@ -598,6 +599,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
598599 & mut this. cx . borrowck_context . constraints . outlives_constraints ,
599600 & mut constraints,
600601 ) ;
602+ mem:: swap ( & mut this. cx . borrowck_context . constraints . type_tests , & mut type_tests) ;
601603 mem:: swap (
602604 & mut this. cx . borrowck_context . constraints . closure_bounds_mapping ,
603605 & mut closure_bounds,
@@ -622,6 +624,13 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
622624 swap_constraints ( self ) ;
623625
624626 let locations = location. to_locations ( ) ;
627+
628+ // Use location of promoted const in collected constraints
629+ for type_test in type_tests. iter ( ) {
630+ let mut type_test = type_test. clone ( ) ;
631+ type_test. locations = locations;
632+ self . cx . borrowck_context . constraints . type_tests . push ( type_test)
633+ }
625634 for constraint in constraints. outlives ( ) . iter ( ) {
626635 let mut constraint = constraint. clone ( ) ;
627636 constraint. locations = locations;
0 commit comments