From d1ebdbeb6c00fe7d119ce17cabb303c5731f9bf7 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 28 Nov 2012 13:51:50 -0800 Subject: librustc: Implement explicit self for Add and Index; add a hack in the borrow checker to support this. r=nmatsakis --- src/libstd/smallintmap.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libstd/smallintmap.rs') diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index b83387a87ba..3e82c3c9419 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -150,6 +150,7 @@ impl SmallIntMap: map::Map { } } +#[cfg(stage0)] impl SmallIntMap: ops::Index { pure fn index(key: uint) -> V { unsafe { @@ -157,6 +158,15 @@ impl SmallIntMap: ops::Index { } } } +#[cfg(stage1)] +#[cfg(stage2)] +impl SmallIntMap: ops::Index { + pure fn index(&self, key: uint) -> V { + unsafe { + get(*self, key) + } + } +} /// Cast the given smallintmap to a map::map pub fn as_map(s: SmallIntMap) -> map::Map { -- cgit 1.4.1-3-g733a5