@@ -21,7 +21,7 @@ use rustc_middle::query::Providers;
21
21
use rustc_middle:: ty:: { self , TyCtxt , TypeSuperVisitable , TypeVisitor } ;
22
22
use rustc_session:: lint;
23
23
use rustc_span:: def_id:: DefId ;
24
- use rustc_span:: symbol:: { sym , Ident } ;
24
+ use rustc_span:: symbol:: Ident ;
25
25
use rustc_span:: { Span , DUMMY_SP } ;
26
26
use std:: fmt;
27
27
@@ -1197,68 +1197,14 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1197
1197
break None ;
1198
1198
}
1199
1199
1200
- Scope :: Binder { ref bound_vars, scope_type, s, where_bound_origin , .. } => {
1200
+ Scope :: Binder { ref bound_vars, scope_type, s, .. } => {
1201
1201
if let Some ( & def) = bound_vars. get ( & region_def_id) {
1202
1202
break Some ( def. shifted ( late_depth) ) ;
1203
1203
}
1204
1204
match scope_type {
1205
1205
BinderScopeType :: Normal => late_depth += 1 ,
1206
1206
BinderScopeType :: Concatenating => { }
1207
1207
}
1208
- // Fresh lifetimes in APIT used to be allowed in async fns and forbidden in
1209
- // regular fns.
1210
- if let Some ( hir:: PredicateOrigin :: ImplTrait ) = where_bound_origin
1211
- && let hir:: LifetimeName :: Param ( param_id) = lifetime_ref. res
1212
- && let Some ( generics) = self . tcx . hir ( ) . get_generics ( self . tcx . local_parent ( param_id) )
1213
- && let Some ( param) = generics. params . iter ( ) . find ( |p| p. def_id == param_id)
1214
- && param. is_elided_lifetime ( )
1215
- && !self . tcx . asyncness ( lifetime_ref. hir_id . owner . def_id ) . is_async ( )
1216
- && !self . tcx . features ( ) . anonymous_lifetime_in_impl_trait
1217
- {
1218
- let mut diag = rustc_session:: parse:: feature_err (
1219
- & self . tcx . sess . parse_sess ,
1220
- sym:: anonymous_lifetime_in_impl_trait,
1221
- lifetime_ref. ident . span ,
1222
- "anonymous lifetimes in `impl Trait` are unstable" ,
1223
- ) ;
1224
-
1225
- if let Some ( generics) =
1226
- self . tcx . hir ( ) . get_generics ( lifetime_ref. hir_id . owner . def_id )
1227
- {
1228
- let new_param_sugg = if let Some ( span) =
1229
- generics. span_for_lifetime_suggestion ( )
1230
- {
1231
- ( span, "'a, " . to_owned ( ) )
1232
- } else {
1233
- ( generics. span , "<'a>" . to_owned ( ) )
1234
- } ;
1235
-
1236
- let lifetime_sugg = match lifetime_ref. suggestion_position ( ) {
1237
- ( hir:: LifetimeSuggestionPosition :: Normal , span) => ( span, "'a" . to_owned ( ) ) ,
1238
- ( hir:: LifetimeSuggestionPosition :: Ampersand , span) => ( span, "'a " . to_owned ( ) ) ,
1239
- ( hir:: LifetimeSuggestionPosition :: ElidedPath , span) => ( span, "<'a>" . to_owned ( ) ) ,
1240
- ( hir:: LifetimeSuggestionPosition :: ElidedPathArgument , span) => ( span, "'a, " . to_owned ( ) ) ,
1241
- ( hir:: LifetimeSuggestionPosition :: ObjectDefault , span) => ( span, "+ 'a" . to_owned ( ) ) ,
1242
- } ;
1243
- let suggestions = vec ! [
1244
- lifetime_sugg,
1245
- new_param_sugg,
1246
- ] ;
1247
-
1248
- diag. span_label (
1249
- lifetime_ref. ident . span ,
1250
- "expected named lifetime parameter" ,
1251
- ) ;
1252
- diag. multipart_suggestion (
1253
- "consider introducing a named lifetime parameter" ,
1254
- suggestions,
1255
- rustc_errors:: Applicability :: MaybeIncorrect ,
1256
- ) ;
1257
- }
1258
-
1259
- diag. emit ( ) ;
1260
- return ;
1261
- }
1262
1208
scope = s;
1263
1209
}
1264
1210
0 commit comments