@@ -2,6 +2,8 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
2
2
use rustc_index:: bit_set:: HybridBitSet ;
3
3
use rustc_index:: interval:: IntervalSet ;
4
4
use rustc_infer:: infer:: canonical:: QueryRegionConstraints ;
5
+ use rustc_infer:: infer:: outlives:: test_type_match;
6
+ use rustc_infer:: infer:: region_constraints:: VerifyIfEq ;
5
7
use rustc_middle:: mir:: { BasicBlock , Body , ConstraintCategory , Local , Location } ;
6
8
use rustc_middle:: traits:: query:: DropckOutlivesResult ;
7
9
use rustc_middle:: ty:: {
@@ -568,6 +570,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
568
570
bug ! ( ) ;
569
571
} ;
570
572
let tcx = self . typeck . infcx . tcx ;
573
+ let param_env = self . typeck . param_env ;
571
574
let mut outlives_bounds = tcx
572
575
. item_bounds ( alias_ty. def_id )
573
576
. iter_instantiated ( tcx, alias_ty. args )
@@ -579,7 +582,24 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
579
582
} else {
580
583
None
581
584
}
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
+ } ) ) ;
583
603
if let Some ( r) = outlives_bounds. next ( )
584
604
&& !r. is_late_bound ( )
585
605
&& outlives_bounds. all ( |other_r| {
0 commit comments