@@ -3,6 +3,8 @@ use rustc_data_structures::graph::WithSuccessors;
3
3
use rustc_index:: bit_set:: { HybridBitSet , SparseBitMatrix } ;
4
4
use rustc_index:: interval:: IntervalSet ;
5
5
use rustc_infer:: infer:: canonical:: QueryRegionConstraints ;
6
+ use rustc_infer:: infer:: outlives:: test_type_match;
7
+ use rustc_infer:: infer:: region_constraints:: VerifyIfEq ;
6
8
use rustc_middle:: mir:: { BasicBlock , Body , ConstraintCategory , Local , Location } ;
7
9
use rustc_middle:: traits:: query:: DropckOutlivesResult ;
8
10
use rustc_middle:: ty:: {
@@ -622,6 +624,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
622
624
bug ! ( ) ;
623
625
} ;
624
626
let tcx = self . typeck . infcx . tcx ;
627
+ let param_env = self . typeck . param_env ;
625
628
let mut outlives_bounds = tcx
626
629
. item_bounds ( alias_ty. def_id )
627
630
. iter_instantiated ( tcx, alias_ty. args )
@@ -633,7 +636,24 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
633
636
} else {
634
637
None
635
638
}
636
- } ) ;
639
+ } )
640
+ . chain ( param_env. caller_bounds ( ) . iter ( ) . filter_map ( |clause| {
641
+ let outlives = clause. as_type_outlives_clause ( ) ?;
642
+ if let Some ( outlives) = outlives. no_bound_vars ( )
643
+ && outlives. 0 == t
644
+ {
645
+ Some ( outlives. 1 )
646
+ } else {
647
+ test_type_match:: extract_verify_if_eq (
648
+ tcx,
649
+ param_env,
650
+ & outlives. map_bound ( |ty:: OutlivesPredicate ( ty, bound) | {
651
+ VerifyIfEq { ty, bound }
652
+ } ) ,
653
+ t,
654
+ )
655
+ }
656
+ } ) ) ;
637
657
if let Some ( r) = outlives_bounds. next ( )
638
658
&& !r. is_late_bound ( )
639
659
&& outlives_bounds. all ( |other_r| {
0 commit comments