diff options
| author | bors <bors@rust-lang.org> | 2014-12-30 17:51:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-12-30 17:51:21 +0000 |
| commit | 84f5ad8679c7fc454473ffbf389030f3e5fee379 (patch) | |
| tree | 0ff540834e21c0927e1efa8bad5f4f37fac86286 /src/libsyntax | |
| parent | 023dfb0c898d851dee6ace2f8339b73b5287136b (diff) | |
| parent | e186accbc43dad8c340112fc39d8df924a9a79e9 (diff) | |
| download | rust-84f5ad8679c7fc454473ffbf389030f3e5fee379.tar.gz rust-84f5ad8679c7fc454473ffbf389030f3e5fee379.zip | |
auto merge of #20307 : nikomatsakis/rust/assoc-types-normalization-extend-bound, r=nrc
Rewrite associated types to use projection rather than dummy type parameters. This closes almost every (major) open issue, but I'm holding off on that until the code has landed and baked a bit. Probably it should have more tests, as well, but I wanted to get this landed as fast as possible so that we can collaborate on improving it. The commit history is a little messy, particularly the merge commit at the end. If I get some time, I might just "reset" to the beginning and try to carve up the final state into logical pieces. Let me know if it seems hard to follow. By far the most crucial commit is "Implement associated type projection and normalization." r? @nick29581
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index f253943943d..12432c8c78f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -764,7 +764,7 @@ pub enum Expr_ { pub struct QPath { pub self_type: P<Ty>, pub trait_ref: P<TraitRef>, - pub item_name: Ident, + pub item_name: Ident, // FIXME(#20301) -- should use Name } #[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 1cd21ccac7a..40ca6354ca6 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -133,6 +133,9 @@ pub trait Visitor<'v> { fn visit_path_parameters(&mut self, path_span: Span, path_parameters: &'v PathParameters) { walk_path_parameters(self, path_span, path_parameters) } + fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding) { + walk_assoc_type_binding(self, type_binding) + } fn visit_attribute(&mut self, _attr: &'v Attribute) {} } @@ -467,6 +470,9 @@ pub fn walk_path_parameters<'v, V: Visitor<'v>>(visitor: &mut V, for lifetime in data.lifetimes.iter() { visitor.visit_lifetime_ref(lifetime); } + for binding in data.bindings.iter() { + visitor.visit_assoc_type_binding(&**binding); + } } ast::ParenthesizedParameters(ref data) => { for typ in data.inputs.iter() { @@ -479,6 +485,12 @@ pub fn walk_path_parameters<'v, V: Visitor<'v>>(visitor: &mut V, } } +pub fn walk_assoc_type_binding<'v, V: Visitor<'v>>(visitor: &mut V, + type_binding: &'v TypeBinding) { + visitor.visit_ident(type_binding.span, type_binding.ident); + visitor.visit_ty(&*type_binding.ty); +} + pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) { match pattern.node { PatEnum(ref path, ref children) => { |
