about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2014-08-14 01:02:31 +0200
committerMarvin Löbel <loebel.marvin@gmail.com>2014-08-16 21:13:39 +0200
commit13079c1a85c2f3391966cc108a48f2313596d78d (patch)
tree0a3e884a73861eb5357d1108b95139e745896377 /src/libstd
parent78ec3904b443c818d9f83e837ca13e5f197db740 (diff)
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
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index c95dd8618ed..e93a958acc6 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -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))
     }