about summary refs log tree commit diff
path: root/src/libsyntax/codemap.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-03-06 13:58:02 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-03-07 22:37:57 -0800
commitd7e74b5e91b0b6b6a5613f54479d2ef9fe9c392f (patch)
treeb1ce2f5b126be2790aad28ac0c0e526979d91e49 /src/libsyntax/codemap.rs
parent0ea031bcb8c237365b8bf15ae474972570cf15f9 (diff)
downloadrust-d7e74b5e91b0b6b6a5613f54479d2ef9fe9c392f.tar.gz
rust-d7e74b5e91b0b6b6a5613f54479d2ef9fe9c392f.zip
librustc: Convert all uses of `assert` over to `fail_unless!`
Diffstat (limited to 'src/libsyntax/codemap.rs')
-rw-r--r--src/libsyntax/codemap.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 1038982d353..a525c0df5fa 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -253,7 +253,7 @@ pub impl FileMap {
     // about what ends a line between this file and parse.rs
     fn next_line(&self, +pos: BytePos) {
         // the new charpos must be > the last one (or it's the first one).
-        assert ((self.lines.len() == 0)
+        fail_unless!((self.lines.len() == 0)
                 || (self.lines[self.lines.len() - 1] < pos));
         self.lines.push(pos);
     }
@@ -272,7 +272,7 @@ pub impl FileMap {
     }
 
     pub fn record_multibyte_char(&self, pos: BytePos, bytes: uint) {
-        assert bytes >=2 && bytes <= 4;
+        fail_unless!(bytes >=2 && bytes <= 4);
         let mbc = MultiByteChar {
             pos: pos,
             bytes: bytes,
@@ -393,7 +393,7 @@ pub impl CodeMap {
     pub fn span_to_snippet(&self, sp: span) -> ~str {
         let begin = self.lookup_byte_offset(sp.lo);
         let end = self.lookup_byte_offset(sp.hi);
-        assert begin.fm.start_pos == end.fm.start_pos;
+        fail_unless!(begin.fm.start_pos == end.fm.start_pos);
         return str::slice(*begin.fm.src,
                           begin.pos.to_uint(), end.pos.to_uint());
     }
@@ -453,7 +453,7 @@ priv impl CodeMap {
         debug!("codemap: char pos %? is on the line at char pos %?",
                chpos, linechpos);
         debug!("codemap: byte is on line: %?", line);
-        assert chpos >= linechpos;
+        fail_unless!(chpos >= linechpos);
         return Loc {
             file: f,
             line: line,
@@ -492,8 +492,8 @@ priv impl CodeMap {
                 total_extra_bytes += mbc.bytes;
                 // We should never see a byte position in the middle of a
                 // character
-                assert bpos == mbc.pos
-                    || bpos.to_uint() >= mbc.pos.to_uint() + mbc.bytes;
+                fail_unless!(bpos == mbc.pos
+                    || bpos.to_uint() >= mbc.pos.to_uint() + mbc.bytes);
             } else {
                 break;
             }