diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 3535c6e267eba..749a92f04d827 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -665,8 +665,11 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_method: &'v Tr RequiredMethod(ref method_type) => visitor.visit_ty_method(method_type), ProvidedMethod(ref method) => walk_method_helper(visitor, &**method), TypeTraitItem(ref associated_type) => { - visitor.visit_ident(associated_type.ty_param.span, - associated_type.ty_param.ident) + let typ = &associated_type.ty_param; + visitor.visit_ident(typ.span, typ.ident); + walk_ty_param_bounds_helper(visitor, &typ.bounds); + typ.default.as_ref().map(|t| visitor.visit_ty(&**t)); + typ.unbound.as_ref().map(|t| visitor.visit_trait_ref(t)); } } } diff --git a/src/test/run-pass/associated-type-lifetime.rs b/src/test/run-pass/associated-type-lifetime.rs new file mode 100644 index 0000000000000..1c68c94ce0f5e --- /dev/null +++ b/src/test/run-pass/associated-type-lifetime.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(associated_types)] + +trait Foo<'a> { + type I : Iterator<&'a int>; +} + +fn main() { }