mozilla/rust — pull request #10449 by alexcrichton (2013-11-12 21:33:56+00:00)
Title: Remove io::io_error

This commit removes all usage of conditions from the runtime and I/O
implementation. The new idea is to return IoResult which is a typedef on
Result. The error portion of this may wish to change in the future,
but for now it's a good step forward to remove conditions.

Some notable changes:

* the `if_ok!`/`seq!` macros -- right now these are only defined in libstd, but they're definitely in the wrong spot and may belong in the core-macro injection as well.
* Removed ByteIterator - no way to propagate I/O errors any more
* The fmt traits must now return IoResult<()> - need to propagate errors
* All I/O errors in json encoding/decode are now ignored
* All I/O errors in rustdoc are now ignored
* The signature of print/println has changed - need to propagate the error
* The signature of read_bytes() has changed - need to return partially-read data

This is not quite ready for merging just yet. I'd like to get some feedback on this before cleaning this up for a true merge. I don't like how errors are default not-fatal any more, but the code isn't really that much less readable in my opinion. There's also not a lot of heavy I/O code except for rustdoc which just ignores all errors, so this perhaps isn't the best showcase of conversion.

I'm mainly soliciting for feedback about this. I think that this is the right way to go in general (moving away from conditions), but if there are any reservations about the specifics we should probably discuss them now.