aboutsummaryrefslogtreecommitdiff
path: root/src/lib/_vec.rs
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-05-02 16:24:09 -0700
committerGraydon Hoare <[email protected]>2011-05-02 17:35:33 -0700
commitd08b443fffb1181d8d45ae5d061412f202dd4118 (patch)
treead75b4e4fc9407aa1201f9068012f30664d17b64 /src/lib/_vec.rs
parentAdd a regression test that exports can expose unexported items (diff)
downloadrust-d08b443fffb1181d8d45ae5d061412f202dd4118.tar.xz
rust-d08b443fffb1181d8d45ae5d061412f202dd4118.zip
Revert "Use different syntax for checks that matter to typestate"
This reverts commit aa25f22f197682de3b18fc4c8ba068d1feda220f. It broke stage2, not sure why yet.
Diffstat (limited to 'src/lib/_vec.rs')
-rw-r--r--src/lib/_vec.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs
index 4761a867..126bf363 100644
--- a/src/lib/_vec.rs
+++ b/src/lib/_vec.rs
@@ -131,7 +131,7 @@ fn len_set[T](array[T] v, uint n) {
}
fn buf_off[T](array[T] v, uint offset) -> vbuf {
- assert (offset < len[T](v));
+ check (offset < len[T](v));
ret rustrt.vec_buf[T](v, offset);
}
@@ -149,10 +149,9 @@ fn last[T](array[T] v) -> option.t[T] {
}
// Returns elements from [start..end) from v.
-
fn slice[T](array[T] v, uint start, uint end) -> vec[T] {
- assert (start <= end);
- assert (end <= len[T](v));
+ check (start <= end);
+ check (end <= len[T](v));
auto result = alloc[T](end - start);
let uint i = start;
while (i < end) {
@@ -164,7 +163,7 @@ fn slice[T](array[T] v, uint start, uint end) -> vec[T] {
fn shift[T](&mutable array[T] v) -> T {
auto ln = len[T](v);
- assert (ln > 0u);
+ check(ln > 0u);
auto e = v.(0);
v = slice[T](v, 1u, ln);
ret e;
@@ -172,7 +171,7 @@ fn shift[T](&mutable array[T] v) -> T {
fn pop[T](&mutable array[T] v) -> T {
auto ln = len[T](v);
- assert (ln > 0u);
+ check(ln > 0u);
ln -= 1u;
auto e = v.(ln);
v = slice[T](v, 0u, ln);