@@ -2,6 +2,8 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
22use rustc_index:: bit_set:: HybridBitSet ;
33use rustc_index:: interval:: IntervalSet ;
44use rustc_infer:: infer:: canonical:: QueryRegionConstraints ;
5+ use rustc_infer:: infer:: outlives:: test_type_match;
6+ use rustc_infer:: infer:: region_constraints:: VerifyIfEq ;
57use rustc_middle:: mir:: { BasicBlock , Body , ConstraintCategory , Local , Location } ;
68use rustc_middle:: traits:: query:: DropckOutlivesResult ;
79use rustc_middle:: ty:: {
@@ -568,6 +570,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
568570 bug ! ( ) ;
569571 } ;
570572 let tcx = self . typeck . infcx . tcx ;
573+ let param_env = self . typeck . param_env ;
571574 let mut outlives_bounds = tcx
572575 . item_bounds ( alias_ty. def_id )
573576 . iter_instantiated ( tcx, alias_ty. args )
@@ -579,7 +582,24 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
579582 } else {
580583 None
581584 }
582- } ) ;
585+ } )
586+ . chain ( param_env. caller_bounds ( ) . iter ( ) . filter_map ( |clause| {
587+ let outlives = clause. as_type_outlives_clause ( ) ?;
588+ if let Some ( outlives) = outlives. no_bound_vars ( )
589+ && outlives. 0 == t
590+ {
591+ Some ( outlives. 1 )
592+ } else {
593+ test_type_match:: extract_verify_if_eq (
594+ tcx,
595+ param_env,
596+ & outlives. map_bound ( |ty:: OutlivesPredicate ( ty, bound) | {
597+ VerifyIfEq { ty, bound }
598+ } ) ,
599+ t,
600+ )
601+ }
602+ } ) ) ;
583603 if let Some ( r) = outlives_bounds. next ( )
584604 && !r. is_late_bound ( )
585605 && outlives_bounds. all ( |other_r| {
0 commit comments