diff options
| author | Tim Chevalier <[email protected]> | 2011-05-02 11:23:07 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-05-02 12:16:29 -0700 |
| commit | aa25f22f197682de3b18fc4c8ba068d1feda220f (patch) | |
| tree | 6d01f8fbb5680964fd9c53564c96aa58cb75d3d1 /src/lib/io.rs | |
| parent | rustc: Add a "fat tydesc" LLVM type to trans (diff) | |
| download | rust-aa25f22f197682de3b18fc4c8ba068d1feda220f.tar.xz rust-aa25f22f197682de3b18fc4c8ba068d1feda220f.zip | |
Use different syntax for checks that matter to typestate
This giant commit changes the syntax of Rust to use "assert" for
"check" expressions that didn't mean anything to the typestate
system, and continue using "check" for checks that are used as
part of typestate checking.
Most of the changes are just replacing "check" with "assert" in test
cases and rustc.
Diffstat (limited to 'src/lib/io.rs')
| -rw-r--r-- | src/lib/io.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/io.rs b/src/lib/io.rs index 4c1bf2df..7d59da30 100644 --- a/src/lib/io.rs +++ b/src/lib/io.rs @@ -72,7 +72,7 @@ state obj FILE_buf_reader(os.libc.FILE f, bool must_close) { ret os.libc.feof(f) != 0; } fn seek(int offset, seek_style whence) { - check (os.libc.fseek(f, offset, convert_whence(whence)) == 0); + assert (os.libc.fseek(f, offset, convert_whence(whence)) == 0); } fn tell() -> uint { ret os.libc.ftell(f) as uint; @@ -101,14 +101,14 @@ state obj new_reader(buf_reader rdr) { if (c0 == -1) {ret -1 as char;} // FIXME will this stay valid? auto b0 = c0 as u8; auto w = _str.utf8_char_width(b0); - check(w > 0u); + assert (w > 0u); if (w == 1u) {ret b0 as char;} auto val = 0u; while (w > 1u) { w -= 1u; auto next = rdr.read_byte(); - check(next > -1); - check(next & 0xc0 == 0x80); + assert (next > -1); + assert (next & 0xc0 == 0x80); val <<= 6u; val += (next & 0x3f) as uint; } @@ -279,7 +279,7 @@ state obj FILE_writer(os.libc.FILE f, bool must_close) { } fn seek(int offset, seek_style whence) { - check(os.libc.fseek(f, offset, convert_whence(whence)) == 0); + assert (os.libc.fseek(f, offset, convert_whence(whence)) == 0); } fn tell() -> uint { |