Optimized IR generation for UTF-8 and UTF-16 encoding
- Both can now be inlined and constant folded away - Both can no longer cause failure - Both now return an `Option` instead Removed debug `assert!()`s over the valid ranges of a `char` - It affected optimizations due to unwinding - Char handling is now sound enought that they became uneccessary
This commit is contained in:
@@ -1110,7 +1110,7 @@ pub trait Writer {
|
||||
#[inline]
|
||||
fn write_char(&mut self, c: char) -> IoResult<()> {
|
||||
let mut buf = [0u8, ..4];
|
||||
let n = c.encode_utf8(buf.as_mut_slice());
|
||||
let n = c.encode_utf8(buf.as_mut_slice()).unwrap_or(0);
|
||||
self.write(buf.slice_to(n))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user