From 9907fa4acc2af5b2b07d1362b3ceb29171954c58 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 4 Aug 2014 13:56:56 -0700 Subject: librustc: Stop assuming that implementations and traits only contain methods. This paves the way to associated items by introducing an extra level of abstraction ("impl-or-trait item") between traits/implementations and methods. This new abstraction is encoded in the metadata and used throughout the compiler where appropriate. There are no functional changes; this is purely a refactoring. --- src/libsyntax/ext/deriving/generic/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 5842ca4a0d5..7a8ee6d1416 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -452,8 +452,13 @@ impl<'a> TraitDef<'a> { self.span, ident, (vec!(attr)).append(self.attributes.as_slice()), - ast::ItemImpl(trait_generics, opt_trait_ref, - self_type, methods)) + ast::ItemImpl(trait_generics, + opt_trait_ref, + self_type, + methods.move_iter() + .map(|method| { + ast::MethodImplItem(method) + }).collect())) } fn expand_struct_def(&self, -- cgit 1.4.1-3-g733a5