diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-08-27 21:46:52 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-08-27 21:46:52 -0400 |
| commit | 1b487a890695e7d6dfbfe5dcd7d4fa0e8ca8003f (patch) | |
| tree | 552fabade603ab0d148a49ae3cf1abd3f399740a /src/libsyntax/ast_map | |
| parent | 3ee047ae1ffab454270bc1859b3beef3556ef8f9 (diff) | |
| download | rust-1b487a890695e7d6dfbfe5dcd7d4fa0e8ca8003f.tar.gz rust-1b487a890695e7d6dfbfe5dcd7d4fa0e8ca8003f.zip | |
Implement generalized object and type parameter bounds (Fixes #16462)
Diffstat (limited to 'src/libsyntax/ast_map')
| -rw-r--r-- | src/libsyntax/ast_map/mod.rs | 22 |
1 files changed, 16 insertions, 6 deletions
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<PathElem> 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<T> for Values<'a, T> { fn next(&mut self) -> Option<T> { 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) => { |
