@@ -6853,19 +6853,6 @@ impl<'tcx> ctxt<'tcx> {
6853
6853
|br| ty:: ReFree ( ty:: FreeRegion { scope : all_outlive_scope, bound_region : br} ) ) . 0
6854
6854
}
6855
6855
6856
- pub fn count_late_bound_regions < T > ( & self , value : & Binder < T > ) -> usize
6857
- where T : TypeFoldable < ' tcx >
6858
- {
6859
- let ( _, skol_map) = ty_fold:: replace_late_bound_regions ( self , value, |_| ty:: ReStatic ) ;
6860
- skol_map. len ( )
6861
- }
6862
-
6863
- pub fn binds_late_bound_regions < T > ( & self , value : & Binder < T > ) -> bool
6864
- where T : TypeFoldable < ' tcx >
6865
- {
6866
- self . count_late_bound_regions ( value) > 0
6867
- }
6868
-
6869
6856
/// Flattens two binding levels into one. So `for<'a> for<'b> Foo`
6870
6857
/// becomes `for<'a,'b> Foo`.
6871
6858
pub fn flatten_late_bound_regions < T > ( & self , bound2_value : & Binder < Binder < T > > )
@@ -6890,9 +6877,9 @@ impl<'tcx> ctxt<'tcx> {
6890
6877
}
6891
6878
6892
6879
pub fn no_late_bound_regions < T > ( & self , value : & Binder < T > ) -> Option < T >
6893
- where T : TypeFoldable < ' tcx >
6880
+ where T : TypeFoldable < ' tcx > + RegionEscape
6894
6881
{
6895
- if self . binds_late_bound_regions ( value ) {
6882
+ if value . 0 . has_escaping_regions ( ) {
6896
6883
None
6897
6884
} else {
6898
6885
Some ( value. 0 . clone ( ) )
@@ -7052,6 +7039,19 @@ impl<'tcx> RegionEscape for Substs<'tcx> {
7052
7039
}
7053
7040
}
7054
7041
7042
+ impl < T : RegionEscape > RegionEscape for Vec < T > {
7043
+ fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
7044
+ self . iter ( ) . any ( |t| t. has_regions_escaping_depth ( depth) )
7045
+ }
7046
+ }
7047
+
7048
+ impl < ' tcx > RegionEscape for FnSig < ' tcx > {
7049
+ fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
7050
+ self . inputs . has_regions_escaping_depth ( depth) ||
7051
+ self . output . has_regions_escaping_depth ( depth)
7052
+ }
7053
+ }
7054
+
7055
7055
impl < ' tcx , T : RegionEscape > RegionEscape for VecPerParamSpace < T > {
7056
7056
fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
7057
7057
self . iter_enumerated ( ) . any ( |( space, _, t) | {
@@ -7124,6 +7124,15 @@ impl<'tcx,T:RegionEscape> RegionEscape for Binder<T> {
7124
7124
}
7125
7125
}
7126
7126
7127
+ impl < ' tcx > RegionEscape for FnOutput < ' tcx > {
7128
+ fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
7129
+ match * self {
7130
+ FnConverging ( t) => t. has_regions_escaping_depth ( depth) ,
7131
+ FnDiverging => false
7132
+ }
7133
+ }
7134
+ }
7135
+
7127
7136
impl < ' tcx > RegionEscape for EquatePredicate < ' tcx > {
7128
7137
fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
7129
7138
self . 0 . has_regions_escaping_depth ( depth) || self . 1 . has_regions_escaping_depth ( depth)
0 commit comments