@@ -206,7 +206,8 @@ impl<'a> LifetimeContext<'a> {
206
206
207
207
self . check_lifetime_names ( & generics. lifetimes ) ;
208
208
209
- let referenced_idents = free_lifetimes ( & generics. ty_params ) ;
209
+ let referenced_idents = free_lifetimes ( & generics. ty_params ,
210
+ & generics. where_clause ) ;
210
211
debug ! ( "pushing fn scope id={} due to fn item/method\
211
212
referenced_idents={:?}",
212
213
n,
@@ -403,7 +404,8 @@ fn search_lifetimes(lifetimes: &Vec<ast::LifetimeDef>,
403
404
///////////////////////////////////////////////////////////////////////////
404
405
405
406
pub fn early_bound_lifetimes < ' a > ( generics : & ' a ast:: Generics ) -> Vec < ast:: LifetimeDef > {
406
- let referenced_idents = free_lifetimes ( & generics. ty_params ) ;
407
+ let referenced_idents = free_lifetimes ( & generics. ty_params ,
408
+ & generics. where_clause ) ;
407
409
if referenced_idents. is_empty ( ) {
408
410
return Vec :: new ( ) ;
409
411
}
@@ -414,7 +416,9 @@ pub fn early_bound_lifetimes<'a>(generics: &'a ast::Generics) -> Vec<ast::Lifeti
414
416
. collect ( )
415
417
}
416
418
417
- pub fn free_lifetimes ( ty_params : & OwnedSlice < ast:: TyParam > ) -> Vec < ast:: Name > {
419
+ pub fn free_lifetimes ( ty_params : & OwnedSlice < ast:: TyParam > ,
420
+ where_clause : & ast:: WhereClause )
421
+ -> Vec < ast:: Name > {
418
422
/*!
419
423
* Gathers up and returns the names of any lifetimes that appear
420
424
* free in `ty_params`. Of course, right now, all lifetimes appear
@@ -426,6 +430,9 @@ pub fn free_lifetimes(ty_params: &OwnedSlice<ast::TyParam>) -> Vec<ast::Name> {
426
430
for ty_param in ty_params. iter ( ) {
427
431
visit:: walk_ty_param_bounds ( & mut collector, & ty_param. bounds , ( ) ) ;
428
432
}
433
+ for predicate in where_clause. predicates . iter ( ) {
434
+ visit:: walk_ty_param_bounds ( & mut collector, & predicate. bounds , ( ) ) ;
435
+ }
429
436
return collector. names ;
430
437
431
438
struct FreeLifetimeCollector {
0 commit comments