@@ -3,6 +3,8 @@ use rustc_data_structures::graph::WithSuccessors;
33use rustc_index:: bit_set:: { HybridBitSet , SparseBitMatrix } ;
44use rustc_index:: interval:: IntervalSet ;
55use rustc_infer:: infer:: canonical:: QueryRegionConstraints ;
6+ use rustc_infer:: infer:: outlives:: test_type_match;
7+ use rustc_infer:: infer:: region_constraints:: VerifyIfEq ;
68use rustc_middle:: mir:: { BasicBlock , Body , ConstraintCategory , Local , Location } ;
79use rustc_middle:: traits:: query:: DropckOutlivesResult ;
810use rustc_middle:: ty:: {
@@ -622,6 +624,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
622624 bug ! ( ) ;
623625 } ;
624626 let tcx = self . typeck . infcx . tcx ;
627+ let param_env = self . typeck . param_env ;
625628 let mut outlives_bounds = tcx
626629 . item_bounds ( alias_ty. def_id )
627630 . iter_instantiated ( tcx, alias_ty. args )
@@ -633,7 +636,24 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
633636 } else {
634637 None
635638 }
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+ } ) ) ;
637657 if let Some ( r) = outlives_bounds. next ( )
638658 && !r. is_late_bound ( )
639659 && outlives_bounds. all ( |other_r| {
0 commit comments