From 40d8a12b68426a39456548902c71e002ae71c0b8 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Thu, 9 Jan 2014 21:42:28 +1300 Subject: [PATCH] item_impl holds an Option<> to the trait ref, not a list of trait refs. Therefore, we should not iterate over it. --- src/libsyntax/visit.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 1f0572a778558..d5fb9efe59be6 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -223,12 +223,13 @@ pub fn walk_item>(visitor: &mut V, item: &Item, env: E) walk_enum_def(visitor, enum_definition, type_parameters, env) } ItemImpl(ref type_parameters, - ref trait_references, - typ, - ref methods) => { + ref trait_reference, + typ, + ref methods) => { visitor.visit_generics(type_parameters, env.clone()); - for trait_reference in trait_references.iter() { - walk_trait_ref(visitor, trait_reference, env.clone()) + match *trait_reference { + Some(ref trait_reference) => walk_trait_ref(visitor, trait_reference, env.clone()), + None => () } visitor.visit_ty(typ, env.clone()); for method in methods.iter() {