librustc: Convert all uses of assert
over to fail_unless!
This commit is contained in:
parent
0ea031bcb8
commit
d7e74b5e91
817 changed files with 6378 additions and 6335 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue