summary refs log tree commit diff
path: root/src/libsyntax/util
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-02-13 09:46:46 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-02-19 16:35:31 -0800
commit33923f47e3f90442ae3c604d8ea80992b71611f7 (patch)
tree4130c674d6114c3b6a7399b599e98cf62fca3aac /src/libsyntax/util
parentea0058281cfea06a61e5eb23b31c15e9d1dcfda3 (diff)
downloadrust-33923f47e3f90442ae3c604d8ea80992b71611f7.tar.gz
rust-33923f47e3f90442ae3c604d8ea80992b71611f7.zip
librustc: Remove unique vector patterns from the language.
Preparatory work for removing unique vectors from the language, which is
itself preparatory work for dynamically sized types.
Diffstat (limited to 'src/libsyntax/util')
-rw-r--r--src/libsyntax/util/small_vector.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs
index 32e5b83ee04..d6cc35a6f9d 100644
--- a/src/libsyntax/util/small_vector.rs
+++ b/src/libsyntax/util/small_vector.rs
@@ -81,7 +81,13 @@ impl<T> SmallVector<T> {
     pub fn expect_one(self, err: &'static str) -> T {
         match self {
             One(v) => v,
-            Many([v]) => v,
+            Many(v) => {
+                if v.len() == 1 {
+                    v.move_iter().next().unwrap()
+                } else {
+                    fail!(err)
+                }
+            }
             _ => fail!(err)
         }
     }