diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-11-28 13:51:50 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-12-04 14:51:31 -0800 |
| commit | d1ebdbeb6c00fe7d119ce17cabb303c5731f9bf7 (patch) | |
| tree | bde6bd5862f6838776d2176e52ea96235828e348 /src/libstd/smallintmap.rs | |
| parent | 56ece46f7de9d1703dd39f952afac9bed22633b6 (diff) | |
| download | rust-d1ebdbeb6c00fe7d119ce17cabb303c5731f9bf7.tar.gz rust-d1ebdbeb6c00fe7d119ce17cabb303c5731f9bf7.zip | |
librustc: Implement explicit self for Add and Index; add a hack in the borrow checker to support this. r=nmatsakis
Diffstat (limited to 'src/libstd/smallintmap.rs')
| -rw-r--r-- | src/libstd/smallintmap.rs | 10 |
1 files changed, 10 insertions, 0 deletions
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<V: Copy> SmallIntMap<V>: map::Map<uint, V> { } } +#[cfg(stage0)] impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> { pure fn index(key: uint) -> V { unsafe { @@ -157,6 +158,15 @@ impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> { } } } +#[cfg(stage1)] +#[cfg(stage2)] +impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> { + pure fn index(&self, key: uint) -> V { + unsafe { + get(*self, key) + } + } +} /// Cast the given smallintmap to a map::map pub fn as_map<V: Copy>(s: SmallIntMap<V>) -> map::Map<uint, V> { |
