diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-02-28 12:54:01 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-03-01 22:40:52 -0800 |
| commit | 198cc3d850136582651489328fec221a2b98bfef (patch) | |
| tree | fe47f6fab3d4ead61053684613d0b1852ec7e311 /src/libsyntax/util/small_vector.rs | |
| parent | 58fd6ab90db3eb68c94695e1254a73e57bc44658 (diff) | |
| download | rust-198cc3d850136582651489328fec221a2b98bfef.tar.gz rust-198cc3d850136582651489328fec221a2b98bfef.zip | |
libsyntax: Fix errors arising from the automated `~[T]` conversion
Diffstat (limited to 'src/libsyntax/util/small_vector.rs')
| -rw-r--r-- | src/libsyntax/util/small_vector.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs index 22bf0f0a53f..9eb9871bb21 100644 --- a/src/libsyntax/util/small_vector.rs +++ b/src/libsyntax/util/small_vector.rs @@ -7,8 +7,10 @@ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. + use std::mem; -use std::vec; +use std::vec_ng::Vec; +use std::vec_ng; /// A vector type optimized for cases where the size is almost always 0 or 1 pub enum SmallVector<T> { @@ -73,7 +75,7 @@ impl<T> SmallVector<T> { pub fn get<'a>(&'a self, idx: uint) -> &'a T { match *self { One(ref v) if idx == 0 => v, - Many(ref vs) => &vs[idx], + Many(ref vs) => vs.get(idx), _ => fail!("out of bounds access") } } @@ -104,7 +106,7 @@ impl<T> SmallVector<T> { pub enum MoveItems<T> { priv ZeroIterator, priv OneIterator(T), - priv ManyIterator(vec::MoveItems<T>), + priv ManyIterator(vec_ng::MoveItems<T>), } impl<T> Iterator<T> for MoveItems<T> { @@ -136,6 +138,8 @@ impl<T> Iterator<T> for MoveItems<T> { mod test { use super::*; + use std::vec_ng::Vec; + #[test] fn test_len() { let v: SmallVector<int> = SmallVector::zero(); |
