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