@@ -206,7 +206,8 @@ impl<'a> LifetimeContext<'a> {
206206
207207 self . check_lifetime_names ( & generics. lifetimes ) ;
208208
209- let referenced_idents = free_lifetimes ( & generics. ty_params ) ;
209+ let referenced_idents = free_lifetimes ( & generics. ty_params ,
210+ & generics. where_clause ) ;
210211 debug ! ( "pushing fn scope id={} due to fn item/method\
211212 referenced_idents={:?}",
212213 n,
@@ -403,7 +404,8 @@ fn search_lifetimes(lifetimes: &Vec<ast::LifetimeDef>,
403404///////////////////////////////////////////////////////////////////////////
404405
405406pub 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 ) ;
407409 if referenced_idents. is_empty ( ) {
408410 return Vec :: new ( ) ;
409411 }
@@ -414,7 +416,9 @@ pub fn early_bound_lifetimes<'a>(generics: &'a ast::Generics) -> Vec<ast::Lifeti
414416 . collect ( )
415417}
416418
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 > {
418422 /*!
419423 * Gathers up and returns the names of any lifetimes that appear
420424 * 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> {
426430 for ty_param in ty_params. iter ( ) {
427431 visit:: walk_ty_param_bounds ( & mut collector, & ty_param. bounds , ( ) ) ;
428432 }
433+ for predicate in where_clause. predicates . iter ( ) {
434+ visit:: walk_ty_param_bounds ( & mut collector, & predicate. bounds , ( ) ) ;
435+ }
429436 return collector. names ;
430437
431438 struct FreeLifetimeCollector {
0 commit comments