aboutsummaryrefslogtreecommitdiff
path: root/src/lib/sha1.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/sha1.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/sha1.rs')
-rw-r--r--src/lib/sha1.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/sha1.rs b/src/lib/sha1.rs
index 690489db..3866be1e 100644
--- a/src/lib/sha1.rs
+++ b/src/lib/sha1.rs
@@ -43,7 +43,7 @@ fn mk_sha1() -> sha1 {
fn add_input(&sha1state st, &vec[u8] msg) {
// FIXME: Should be typestate precondition
- assert (!st.computed);
+ check (!st.computed);
for (u8 element in msg) {
st.msg_block.(st.msg_block_idx) = element;
@@ -67,7 +67,7 @@ fn mk_sha1() -> sha1 {
fn process_msg_block(&sha1state st) {
// FIXME: Make precondition
- assert (_vec.len[mutable u32](st.h) == digest_buf_len);
+ check (_vec.len[mutable u32](st.h) == digest_buf_len);
// Constants
auto k = vec(0x5A827999u32,
@@ -192,7 +192,7 @@ fn mk_sha1() -> sha1 {
*/
fn pad_msg(&sha1state st) {
// FIXME: Should be a precondition
- assert (_vec.len[mutable u8](st.msg_block) == msg_block_len);
+ check (_vec.len[mutable u8](st.msg_block) == msg_block_len);
/*
* Check to see if the current message block is too small to hold
@@ -236,7 +236,7 @@ fn mk_sha1() -> sha1 {
fn reset() {
// FIXME: Should be typestate precondition
- assert (_vec.len[mutable u32](st.h) == digest_buf_len);
+ check (_vec.len[mutable u32](st.h) == digest_buf_len);
st.len_low = 0u32;
st.len_high = 0u32;