@@ -24,7 +24,6 @@ use rustc_span::def_id::DefId;
2424use rustc_span:: symbol:: { sym, Ident } ;
2525use rustc_span:: Span ;
2626use std:: borrow:: Cow ;
27- use std:: cell:: Cell ;
2827use std:: fmt;
2928use std:: mem:: take;
3029
@@ -33,8 +32,6 @@ trait RegionExt {
3332
3433 fn late ( index : u32 , hir_map : Map < ' _ > , param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) ;
3534
36- fn late_anon ( named_late_bound_vars : u32 , index : & Cell < u32 > ) -> Region ;
37-
3835 fn id ( & self ) -> Option < DefId > ;
3936
4037 fn shifted ( self , amount : u32 ) -> Region ;
@@ -65,16 +62,9 @@ impl RegionExt for Region {
6562 ( def_id, Region :: LateBound ( depth, idx, def_id. to_def_id ( ) ) )
6663 }
6764
68- fn late_anon ( named_late_bound_vars : u32 , index : & Cell < u32 > ) -> Region {
69- let i = index. get ( ) ;
70- index. set ( i + 1 ) ;
71- let depth = ty:: INNERMOST ;
72- Region :: LateBoundAnon ( depth, named_late_bound_vars + i, i)
73- }
74-
7565 fn id ( & self ) -> Option < DefId > {
7666 match * self {
77- Region :: Static | Region :: LateBoundAnon ( .. ) => None ,
67+ Region :: Static => None ,
7868
7969 Region :: EarlyBound ( _, id) | Region :: LateBound ( _, _, id) | Region :: Free ( _, id) => {
8070 Some ( id)
@@ -87,9 +77,6 @@ impl RegionExt for Region {
8777 Region :: LateBound ( debruijn, idx, id) => {
8878 Region :: LateBound ( debruijn. shifted_in ( amount) , idx, id)
8979 }
90- Region :: LateBoundAnon ( debruijn, index, anon_index) => {
91- Region :: LateBoundAnon ( debruijn. shifted_in ( amount) , index, anon_index)
92- }
9380 _ => self ,
9481 }
9582 }
@@ -99,9 +86,6 @@ impl RegionExt for Region {
9986 Region :: LateBound ( debruijn, index, id) => {
10087 Region :: LateBound ( debruijn. shifted_out_to_binder ( binder) , index, id)
10188 }
102- Region :: LateBoundAnon ( debruijn, index, anon_index) => {
103- Region :: LateBoundAnon ( debruijn. shifted_out_to_binder ( binder) , index, anon_index)
104- }
10589 _ => self ,
10690 }
10791 }
@@ -193,10 +177,6 @@ enum Scope<'a> {
193177
194178 s : ScopeRef < ' a > ,
195179
196- /// In some cases not allowing late bounds allows us to avoid ICEs.
197- /// This is almost ways set to true.
198- allow_late_bound : bool ,
199-
200180 /// If this binder comes from a where clause, specify how it was created.
201181 /// This is used to diagnose inaccessible lifetimes in APIT:
202182 /// ```ignore (illustrative)
@@ -272,7 +252,6 @@ impl<'a> fmt::Debug for TruncatedScopeDebug<'a> {
272252 opaque_type_parent,
273253 scope_type,
274254 hir_id,
275- allow_late_bound,
276255 where_bound_origin,
277256 s : _,
278257 } => f
@@ -282,7 +261,6 @@ impl<'a> fmt::Debug for TruncatedScopeDebug<'a> {
282261 . field ( "opaque_type_parent" , opaque_type_parent)
283262 . field ( "scope_type" , scope_type)
284263 . field ( "hir_id" , hir_id)
285- . field ( "allow_late_bound" , allow_late_bound)
286264 . field ( "where_bound_origin" , where_bound_origin)
287265 . field ( "s" , & ".." )
288266 . finish ( ) ,
@@ -468,9 +446,6 @@ fn late_region_as_bound_region<'tcx>(tcx: TyCtxt<'tcx>, region: &Region) -> ty::
468446 let name = tcx. hir ( ) . name ( tcx. hir ( ) . local_def_id_to_hir_id ( def_id. expect_local ( ) ) ) ;
469447 ty:: BoundVariableKind :: Region ( ty:: BrNamed ( * def_id, name) )
470448 }
471- Region :: LateBoundAnon ( _, _, anon_idx) => {
472- ty:: BoundVariableKind :: Region ( ty:: BrAnon ( * anon_idx) )
473- }
474449 _ => bug ! ( "{:?} is not a late region" , region) ,
475450 }
476451}
@@ -605,7 +580,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
605580 next_early_index,
606581 opaque_type_parent : false ,
607582 scope_type : BinderScopeType :: Normal ,
608- allow_late_bound : true ,
609583 where_bound_origin : None ,
610584 } ;
611585
@@ -724,7 +698,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
724698 opaque_type_parent : true ,
725699 scope_type : BinderScopeType :: Normal ,
726700 s : ROOT_SCOPE ,
727- allow_late_bound : false ,
728701 where_bound_origin : None ,
729702 } ;
730703 self . with ( scope, |this| {
@@ -777,7 +750,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
777750 next_early_index,
778751 opaque_type_parent : false ,
779752 scope_type : BinderScopeType :: Normal ,
780- allow_late_bound : true ,
781753 where_bound_origin : None ,
782754 } ;
783755 self . with ( scope, |this| {
@@ -942,7 +914,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
942914 s : self . scope ,
943915 opaque_type_parent : false ,
944916 scope_type : BinderScopeType :: Normal ,
945- allow_late_bound : false ,
946917 where_bound_origin : None ,
947918 } ;
948919 self . with ( scope, |this| {
@@ -997,7 +968,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
997968 s : self . scope ,
998969 opaque_type_parent : true ,
999970 scope_type : BinderScopeType :: Normal ,
1000- allow_late_bound : false ,
1001971 where_bound_origin : None ,
1002972 } ;
1003973 self . with ( scope, |this| {
@@ -1059,7 +1029,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
10591029 s : self . scope ,
10601030 opaque_type_parent : true ,
10611031 scope_type : BinderScopeType :: Normal ,
1062- allow_late_bound : true ,
10631032 where_bound_origin : None ,
10641033 } ;
10651034 self . with ( scope, |this| {
@@ -1173,7 +1142,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
11731142 next_early_index,
11741143 opaque_type_parent : false ,
11751144 scope_type : BinderScopeType :: Normal ,
1176- allow_late_bound : true ,
11771145 where_bound_origin : Some ( origin) ,
11781146 } ;
11791147 this. with ( scope, |this| {
@@ -1246,7 +1214,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
12461214 next_early_index : self . next_early_index ( ) ,
12471215 opaque_type_parent : false ,
12481216 scope_type,
1249- allow_late_bound : true ,
12501217 where_bound_origin : None ,
12511218 } ;
12521219 self . with ( scope, |this| {
@@ -1297,7 +1264,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
12971264 next_early_index,
12981265 opaque_type_parent : false ,
12991266 scope_type,
1300- allow_late_bound : true ,
13011267 where_bound_origin : None ,
13021268 } ;
13031269 self . with ( scope, |this| {
@@ -1551,7 +1517,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
15511517 s : self . scope ,
15521518 opaque_type_parent : true ,
15531519 scope_type : BinderScopeType :: Normal ,
1554- allow_late_bound : true ,
15551520 where_bound_origin : None ,
15561521 } ;
15571522 self . with ( scope, walk) ;
0 commit comments