rust-lang/rust — pull request #19431 by erickt (2014-12-01 01:08:44+00:00)
Title: std: change BufWriter to return ShortWrite/EndOfFile

Previously, `BufWriter::write` would just return an `std::io::OtherIoError` if someone attempted to write past the end of the wrapped buffer. This pull request changes the error to support partial writes and return a `std::io::ShortWrite`, or an `io::io::EndOfFile` if it's been fully exhausted.

I've also optimized away a bounds check inside `BufWriter::write`, which should help shave off some nanoseconds in an inner loops.