Skip to content

Commit 4f14451

Browse files
authored
Rollup merge of rust-lang#114897 - joshtriplett:partial-revert-ok-0, r=m-ou-se
Partially revert rust-lang#107200 `Ok(0)` is indeed something the caller may interpret as an error, but that's the *correct* thing to return if the writer can't accept any more bytes.
2 parents cd50556 + 5210f48 commit 4f14451

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/std/src/io/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1425,9 +1425,9 @@ pub trait Write {
14251425
///
14261426
/// If this method consumed `n > 0` bytes of `buf` it must return [`Ok(n)`].
14271427
/// If the return value is `Ok(n)` then `n` must satisfy `n <= buf.len()`.
1428-
/// Unless `buf` is empty, this function shouldn’t return `Ok(0)` since the
1429-
/// caller may interpret that as an error. To indicate lack of space,
1430-
/// implementors should return [`ErrorKind::StorageFull`] error instead.
1428+
/// A return value of `Ok(0)` typically means that the underlying object is
1429+
/// no longer able to accept bytes and will likely not be able to in the
1430+
/// future as well, or that the buffer provided is empty.
14311431
///
14321432
/// # Errors
14331433
///

0 commit comments

Comments
 (0)