diff options
Diffstat (limited to 'src/libsyntax/util/small_vector.rs')
| -rw-r--r-- | src/libsyntax/util/small_vector.rs | 8 |
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) } } |
