Created
December 15, 2014 18:30
-
-
Save emberian/e8eb369485fae7983195 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 6d1d74f6d99a7384291c3e95c53a514dfd77b169 Mon Sep 17 00:00:00 2001 | |
From: Corey Richardson <[email protected]> | |
Date: Mon, 15 Dec 2014 13:29:22 -0500 | |
Subject: [PATCH] walk associated types more deeply | |
--- | |
src/libsyntax/visit.rs | 7 +++++-- | |
src/test/run-pass/associated-type-lifetime.rs | 17 +++++++++++++++++ | |
2 files changed, 22 insertions(+), 2 deletions(-) | |
create mode 100644 src/test/run-pass/associated-type-lifetime.rs | |
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs | |
index 3535c6e..749a92f 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 0000000..1c68c94 | |
--- /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 <LICENSE-APACHE or | |
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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() { } | |
-- | |
1.9.3 (Apple Git-50) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment