From 1b487a890695e7d6dfbfe5dcd7d4fa0e8ca8003f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 27 Aug 2014 21:46:52 -0400 Subject: Implement generalized object and type parameter bounds (Fixes #16462) --- src/libsyntax/ast_map/mod.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/libsyntax/ast_map') diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index 5fccf6cc3f0..993c5ce676a 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -68,10 +68,15 @@ impl<'a> Iterator for LinkedPath<'a> { } } -// HACK(eddyb) move this into libstd (value wrapper for slice::Items). +#[cfg(stage0)] #[deriving(Clone)] pub struct Values<'a, T>(pub slice::Items<'a, T>); +// HACK(eddyb) move this into libstd (value wrapper for slice::Items). +#[cfg(not(stage0))] +#[deriving(Clone)] +pub struct Values<'a, T:'a>(pub slice::Items<'a, T>); + impl<'a, T: Copy> Iterator for Values<'a, T> { fn next(&mut self) -> Option { let &Values(ref mut items) = self; @@ -478,6 +483,7 @@ impl Map { } } +#[cfg(stage0)] pub struct NodesMatchingSuffix<'a, S> { map: &'a Map, item_name: &'a S, @@ -485,6 +491,14 @@ pub struct NodesMatchingSuffix<'a, S> { idx: NodeId, } +#[cfg(not(stage0))] +pub struct NodesMatchingSuffix<'a, S:'a> { + map: &'a Map, + item_name: &'a S, + in_which: &'a [S], + idx: NodeId, +} + impl<'a,S:Str> NodesMatchingSuffix<'a,S> { /// Returns true only if some suffix of the module path for parent /// matches `self.in_which`. @@ -676,11 +690,7 @@ impl<'a, F: FoldOps> Folder for Ctx<'a, F> { None => {} } } - ItemTrait(_, _, ref traits, ref methods) => { - for t in traits.iter() { - self.insert(t.ref_id, EntryItem(self.parent, i)); - } - + ItemTrait(_, _, _, ref methods) => { for tm in methods.iter() { match *tm { RequiredMethod(ref m) => { -- cgit 1.4.1-3-g733a5