about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorbcoopers <coopersmithbrian@gmail.com>2015-04-12 13:47:10 -0400
committerbcoopers <coopersmithbrian@gmail.com>2015-04-12 13:47:10 -0400
commitac617b628899282f714fd6a91471d1f0b1cc3217 (patch)
treecf5d5bb5d51094f227f73b586eceb2a69ac00130 /src/libcollections
parentf8493d0660d5ad92a0c244cd0fed0d72b9630ebb (diff)
downloadrust-ac617b628899282f714fd6a91471d1f0b1cc3217.tar.gz
rust-ac617b628899282f714fd6a91471d1f0b1cc3217.zip
The panic! macro can't be called with a variable declared
with "let" when building on stage0. So change the error
message to a static const.
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/vec.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 0a73679a7e6..da1ff2901d0 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -309,10 +309,10 @@ impl<T> Vec<T> {
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn reserve(&mut self, additional: usize) {
         if self.cap - self.len < additional {
-            let err_msg = "Vec::reserve: `isize` overflow";
+            const ERR_MSG: &'static str  = "Vec::reserve: `isize` overflow";
 
-            let new_min_cap = self.len.checked_add(additional).expect(err_msg);
-            if new_min_cap > MAX_MEMORY_SIZE { panic!(err_msg) }
+            let new_min_cap = self.len.checked_add(additional).expect(ERR_MSG);
+            if new_min_cap > MAX_MEMORY_SIZE { panic!(ERR_MSG) }
             self.grow_capacity(match new_min_cap.checked_next_power_of_two() {
                 Some(x) if x > MAX_MEMORY_SIZE => MAX_MEMORY_SIZE,
                 None => MAX_MEMORY_SIZE,