@@ -168,9 +168,6 @@ crate struct LifetimeContext<'a, 'tcx> {
168
168
map : & ' a mut NamedRegionMap ,
169
169
scope : ScopeRef < ' a > ,
170
170
171
- /// Used to disallow the use of in-band lifetimes in `fn` or `Fn` syntax.
172
- is_in_fn_syntax : bool ,
173
-
174
171
/// Indicates that we only care about the definition of a trait. This should
175
172
/// be false if the `Item` we are resolving lifetimes for is not a trait or
176
173
/// we eventually need lifetimes resolve for trait items.
@@ -451,7 +448,6 @@ fn do_resolve(
451
448
tcx,
452
449
map : & mut named_region_map,
453
450
scope : ROOT_SCOPE ,
454
- is_in_fn_syntax : false ,
455
451
trait_definition_only,
456
452
xcrate_object_lifetime_defaults : Default :: default ( ) ,
457
453
lifetime_uses : & mut Default :: default ( ) ,
@@ -869,8 +865,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
869
865
match ty. kind {
870
866
hir:: TyKind :: BareFn ( ref c) => {
871
867
let next_early_index = self . next_early_index ( ) ;
872
- let was_in_fn_syntax = self . is_in_fn_syntax ;
873
- self . is_in_fn_syntax = true ;
874
868
let lifetime_span: Option < Span > =
875
869
c. generic_params . iter ( ) . rev ( ) . find_map ( |param| match param. kind {
876
870
GenericParamKind :: Lifetime { .. } => Some ( param. span ) ,
@@ -911,7 +905,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
911
905
intravisit:: walk_ty ( this, ty) ;
912
906
} ) ;
913
907
self . missing_named_lifetime_spots . pop ( ) ;
914
- self . is_in_fn_syntax = was_in_fn_syntax;
915
908
}
916
909
hir:: TyKind :: TraitObject ( bounds, ref lifetime, _) => {
917
910
debug ! ( ?bounds, ?lifetime, "TraitObject" ) ;
@@ -1685,7 +1678,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
1685
1678
tcx : * tcx,
1686
1679
map,
1687
1680
scope : & wrap_scope,
1688
- is_in_fn_syntax : self . is_in_fn_syntax ,
1689
1681
trait_definition_only : self . trait_definition_only ,
1690
1682
xcrate_object_lifetime_defaults,
1691
1683
lifetime_uses,
@@ -2209,39 +2201,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
2209
2201
}
2210
2202
}
2211
2203
2212
- // Check for fn-syntax conflicts with in-band lifetime definitions
2213
- if !self . trait_definition_only && self . is_in_fn_syntax {
2214
- match def {
2215
- Region :: EarlyBound ( _, _, LifetimeDefOrigin :: InBand )
2216
- | Region :: LateBound ( _, _, _, LifetimeDefOrigin :: InBand ) => {
2217
- struct_span_err ! (
2218
- self . tcx. sess,
2219
- lifetime_ref. span,
2220
- E0687 ,
2221
- "lifetimes used in `fn` or `Fn` syntax must be \
2222
- explicitly declared using `<...>` binders"
2223
- )
2224
- . span_label ( lifetime_ref. span , "in-band lifetime definition" )
2225
- . emit ( ) ;
2226
- }
2227
-
2228
- Region :: Static
2229
- | Region :: EarlyBound (
2230
- _,
2231
- _,
2232
- LifetimeDefOrigin :: ExplicitOrElided | LifetimeDefOrigin :: Error ,
2233
- )
2234
- | Region :: LateBound (
2235
- _,
2236
- _,
2237
- _,
2238
- LifetimeDefOrigin :: ExplicitOrElided | LifetimeDefOrigin :: Error ,
2239
- )
2240
- | Region :: LateBoundAnon ( ..)
2241
- | Region :: Free ( ..) => { }
2242
- }
2243
- }
2244
-
2245
2204
self . insert_lifetime ( lifetime_ref, def) ;
2246
2205
} else {
2247
2206
self . tcx . sess . delay_span_bug (
@@ -2263,10 +2222,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
2263
2222
) ;
2264
2223
2265
2224
if generic_args. parenthesized {
2266
- let was_in_fn_syntax = self . is_in_fn_syntax ;
2267
- self . is_in_fn_syntax = true ;
2268
2225
self . visit_fn_like_elision ( generic_args. inputs ( ) , Some ( generic_args. bindings [ 0 ] . ty ( ) ) ) ;
2269
- self . is_in_fn_syntax = was_in_fn_syntax;
2270
2226
return ;
2271
2227
}
2272
2228
0 commit comments