@@ -24,7 +24,6 @@ use rustc_span::def_id::DefId;
24
24
use rustc_span:: symbol:: { sym, Ident } ;
25
25
use rustc_span:: Span ;
26
26
use std:: borrow:: Cow ;
27
- use std:: cell:: Cell ;
28
27
use std:: fmt;
29
28
use std:: mem:: take;
30
29
@@ -33,8 +32,6 @@ trait RegionExt {
33
32
34
33
fn late ( index : u32 , hir_map : Map < ' _ > , param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) ;
35
34
36
- fn late_anon ( named_late_bound_vars : u32 , index : & Cell < u32 > ) -> Region ;
37
-
38
35
fn id ( & self ) -> Option < DefId > ;
39
36
40
37
fn shifted ( self , amount : u32 ) -> Region ;
@@ -65,16 +62,9 @@ impl RegionExt for Region {
65
62
( def_id, Region :: LateBound ( depth, idx, def_id. to_def_id ( ) ) )
66
63
}
67
64
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
-
75
65
fn id ( & self ) -> Option < DefId > {
76
66
match * self {
77
- Region :: Static | Region :: LateBoundAnon ( .. ) => None ,
67
+ Region :: Static => None ,
78
68
79
69
Region :: EarlyBound ( _, id) | Region :: LateBound ( _, _, id) | Region :: Free ( _, id) => {
80
70
Some ( id)
@@ -87,9 +77,6 @@ impl RegionExt for Region {
87
77
Region :: LateBound ( debruijn, idx, id) => {
88
78
Region :: LateBound ( debruijn. shifted_in ( amount) , idx, id)
89
79
}
90
- Region :: LateBoundAnon ( debruijn, index, anon_index) => {
91
- Region :: LateBoundAnon ( debruijn. shifted_in ( amount) , index, anon_index)
92
- }
93
80
_ => self ,
94
81
}
95
82
}
@@ -99,9 +86,6 @@ impl RegionExt for Region {
99
86
Region :: LateBound ( debruijn, index, id) => {
100
87
Region :: LateBound ( debruijn. shifted_out_to_binder ( binder) , index, id)
101
88
}
102
- Region :: LateBoundAnon ( debruijn, index, anon_index) => {
103
- Region :: LateBoundAnon ( debruijn. shifted_out_to_binder ( binder) , index, anon_index)
104
- }
105
89
_ => self ,
106
90
}
107
91
}
@@ -193,10 +177,6 @@ enum Scope<'a> {
193
177
194
178
s : ScopeRef < ' a > ,
195
179
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
-
200
180
/// If this binder comes from a where clause, specify how it was created.
201
181
/// This is used to diagnose inaccessible lifetimes in APIT:
202
182
/// ```ignore (illustrative)
@@ -272,7 +252,6 @@ impl<'a> fmt::Debug for TruncatedScopeDebug<'a> {
272
252
opaque_type_parent,
273
253
scope_type,
274
254
hir_id,
275
- allow_late_bound,
276
255
where_bound_origin,
277
256
s : _,
278
257
} => f
@@ -282,7 +261,6 @@ impl<'a> fmt::Debug for TruncatedScopeDebug<'a> {
282
261
. field ( "opaque_type_parent" , opaque_type_parent)
283
262
. field ( "scope_type" , scope_type)
284
263
. field ( "hir_id" , hir_id)
285
- . field ( "allow_late_bound" , allow_late_bound)
286
264
. field ( "where_bound_origin" , where_bound_origin)
287
265
. field ( "s" , & ".." )
288
266
. finish ( ) ,
@@ -468,9 +446,6 @@ fn late_region_as_bound_region<'tcx>(tcx: TyCtxt<'tcx>, region: &Region) -> ty::
468
446
let name = tcx. hir ( ) . name ( tcx. hir ( ) . local_def_id_to_hir_id ( def_id. expect_local ( ) ) ) ;
469
447
ty:: BoundVariableKind :: Region ( ty:: BrNamed ( * def_id, name) )
470
448
}
471
- Region :: LateBoundAnon ( _, _, anon_idx) => {
472
- ty:: BoundVariableKind :: Region ( ty:: BrAnon ( * anon_idx) )
473
- }
474
449
_ => bug ! ( "{:?} is not a late region" , region) ,
475
450
}
476
451
}
@@ -605,7 +580,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
605
580
next_early_index,
606
581
opaque_type_parent : false ,
607
582
scope_type : BinderScopeType :: Normal ,
608
- allow_late_bound : true ,
609
583
where_bound_origin : None ,
610
584
} ;
611
585
@@ -724,7 +698,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
724
698
opaque_type_parent : true ,
725
699
scope_type : BinderScopeType :: Normal ,
726
700
s : ROOT_SCOPE ,
727
- allow_late_bound : false ,
728
701
where_bound_origin : None ,
729
702
} ;
730
703
self . with ( scope, |this| {
@@ -777,7 +750,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
777
750
next_early_index,
778
751
opaque_type_parent : false ,
779
752
scope_type : BinderScopeType :: Normal ,
780
- allow_late_bound : true ,
781
753
where_bound_origin : None ,
782
754
} ;
783
755
self . with ( scope, |this| {
@@ -942,7 +914,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
942
914
s : self . scope ,
943
915
opaque_type_parent : false ,
944
916
scope_type : BinderScopeType :: Normal ,
945
- allow_late_bound : false ,
946
917
where_bound_origin : None ,
947
918
} ;
948
919
self . with ( scope, |this| {
@@ -997,7 +968,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
997
968
s : self . scope ,
998
969
opaque_type_parent : true ,
999
970
scope_type : BinderScopeType :: Normal ,
1000
- allow_late_bound : false ,
1001
971
where_bound_origin : None ,
1002
972
} ;
1003
973
self . with ( scope, |this| {
@@ -1059,7 +1029,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
1059
1029
s : self . scope ,
1060
1030
opaque_type_parent : true ,
1061
1031
scope_type : BinderScopeType :: Normal ,
1062
- allow_late_bound : true ,
1063
1032
where_bound_origin : None ,
1064
1033
} ;
1065
1034
self . with ( scope, |this| {
@@ -1173,7 +1142,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
1173
1142
next_early_index,
1174
1143
opaque_type_parent : false ,
1175
1144
scope_type : BinderScopeType :: Normal ,
1176
- allow_late_bound : true ,
1177
1145
where_bound_origin : Some ( origin) ,
1178
1146
} ;
1179
1147
this. with ( scope, |this| {
@@ -1246,7 +1214,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
1246
1214
next_early_index : self . next_early_index ( ) ,
1247
1215
opaque_type_parent : false ,
1248
1216
scope_type,
1249
- allow_late_bound : true ,
1250
1217
where_bound_origin : None ,
1251
1218
} ;
1252
1219
self . with ( scope, |this| {
@@ -1297,7 +1264,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
1297
1264
next_early_index,
1298
1265
opaque_type_parent : false ,
1299
1266
scope_type,
1300
- allow_late_bound : true ,
1301
1267
where_bound_origin : None ,
1302
1268
} ;
1303
1269
self . with ( scope, |this| {
@@ -1551,7 +1517,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
1551
1517
s : self . scope ,
1552
1518
opaque_type_parent : true ,
1553
1519
scope_type : BinderScopeType :: Normal ,
1554
- allow_late_bound : true ,
1555
1520
where_bound_origin : None ,
1556
1521
} ;
1557
1522
self . with ( scope, walk) ;
0 commit comments