@@ -168,9 +168,6 @@ crate struct LifetimeContext<'a, 'tcx> {
168168 map : & ' a mut NamedRegionMap ,
169169 scope : ScopeRef < ' a > ,
170170
171- /// Used to disallow the use of in-band lifetimes in `fn` or `Fn` syntax.
172- is_in_fn_syntax : bool ,
173-
174171 /// Indicates that we only care about the definition of a trait. This should
175172 /// be false if the `Item` we are resolving lifetimes for is not a trait or
176173 /// we eventually need lifetimes resolve for trait items.
@@ -451,7 +448,6 @@ fn do_resolve(
451448 tcx,
452449 map : & mut named_region_map,
453450 scope : ROOT_SCOPE ,
454- is_in_fn_syntax : false ,
455451 trait_definition_only,
456452 xcrate_object_lifetime_defaults : Default :: default ( ) ,
457453 lifetime_uses : & mut Default :: default ( ) ,
@@ -869,8 +865,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
869865 match ty. kind {
870866 hir:: TyKind :: BareFn ( ref c) => {
871867 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 ;
874868 let lifetime_span: Option < Span > =
875869 c. generic_params . iter ( ) . rev ( ) . find_map ( |param| match param. kind {
876870 GenericParamKind :: Lifetime { .. } => Some ( param. span ) ,
@@ -911,7 +905,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
911905 intravisit:: walk_ty ( this, ty) ;
912906 } ) ;
913907 self . missing_named_lifetime_spots . pop ( ) ;
914- self . is_in_fn_syntax = was_in_fn_syntax;
915908 }
916909 hir:: TyKind :: TraitObject ( bounds, ref lifetime, _) => {
917910 debug ! ( ?bounds, ?lifetime, "TraitObject" ) ;
@@ -1685,7 +1678,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
16851678 tcx : * tcx,
16861679 map,
16871680 scope : & wrap_scope,
1688- is_in_fn_syntax : self . is_in_fn_syntax ,
16891681 trait_definition_only : self . trait_definition_only ,
16901682 xcrate_object_lifetime_defaults,
16911683 lifetime_uses,
@@ -2209,39 +2201,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
22092201 }
22102202 }
22112203
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-
22452204 self . insert_lifetime ( lifetime_ref, def) ;
22462205 } else {
22472206 self . tcx . sess . delay_span_bug (
@@ -2263,10 +2222,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
22632222 ) ;
22642223
22652224 if generic_args. parenthesized {
2266- let was_in_fn_syntax = self . is_in_fn_syntax ;
2267- self . is_in_fn_syntax = true ;
22682225 self . visit_fn_like_elision ( generic_args. inputs ( ) , Some ( generic_args. bindings [ 0 ] . ty ( ) ) ) ;
2269- self . is_in_fn_syntax = was_in_fn_syntax;
22702226 return ;
22712227 }
22722228
0 commit comments