From 33923f47e3f90442ae3c604d8ea80992b71611f7 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 13 Feb 2014 09:46:46 -0800 Subject: 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. --- src/libsyntax/util/small_vector.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/util/small_vector.rs') 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 SmallVector { 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) } } -- cgit 1.4.1-3-g733a5