diff options
| author | Graydon Hoare <[email protected]> | 2011-05-02 16:24:09 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-05-02 17:35:33 -0700 |
| commit | d08b443fffb1181d8d45ae5d061412f202dd4118 (patch) | |
| tree | ad75b4e4fc9407aa1201f9068012f30664d17b64 /src/lib/_str.rs | |
| parent | Add a regression test that exports can expose unexported items (diff) | |
| download | rust-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/_str.rs')
| -rw-r--r-- | src/lib/_str.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/_str.rs b/src/lib/_str.rs index ed2027e1..44f14fb6 100644 --- a/src/lib/_str.rs +++ b/src/lib/_str.rs @@ -218,14 +218,14 @@ fn utf8_char_width(u8 b) -> uint { fn char_range_at(str s, uint i) -> tup(char, uint) { auto b0 = s.(i); auto w = utf8_char_width(b0); - assert (w != 0u); + check(w != 0u); if (w == 1u) {ret tup(b0 as char, i + 1u);} auto val = 0u; auto end = i + w; i += 1u; while (i < end) { auto byte = s.(i); - assert (byte & 0xc0_u8 == tag_cont_u8); + check(byte & 0xc0_u8 == tag_cont_u8); val <<= 6u; val += (byte & 0x3f_u8) as uint; i += 1u; @@ -247,11 +247,11 @@ fn char_len(str s) -> uint { auto total = byte_len(s); while (i < total) { auto chsize = utf8_char_width(s.(i)); - assert (chsize > 0u); + check(chsize > 0u); len += 1u; i += chsize; } - assert (i == total); + check(i == total); ret len; } @@ -274,7 +274,7 @@ fn push_char(&mutable str s, char ch) { fn pop_char(&mutable str s) -> char { auto end = byte_len(s); while (end > 0u && s.(end - 1u) & 0xc0_u8 == tag_cont_u8) {end -= 1u;} - assert (end > 0u); + check(end > 0u); auto ch = char_at(s, end - 1u); s = substr(s, 0u, end - 1u); ret ch; @@ -404,7 +404,7 @@ fn slice(str s, uint begin, uint end) -> str { fn shift_byte(&mutable str s) -> u8 { auto len = byte_len(s); - assert (len > 0u); + check(len > 0u); auto b = s.(0); s = substr(s, 1u, len - 1u); ret b; @@ -412,7 +412,7 @@ fn shift_byte(&mutable str s) -> u8 { fn pop_byte(&mutable str s) -> u8 { auto len = byte_len(s); - assert (len > 0u); + check(len > 0u); auto b = s.(len - 1u); s = substr(s, 0u, len - 1u); ret b; |