Skip to content

Commit

Permalink
Rollup merge of rust-lang#114897 - joshtriplett:partial-revert-ok-0, …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
cuviper committed Aug 17, 2023
2 parents cd50556 + 5210f48 commit 4f14451
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1425,9 +1425,9 @@ pub trait Write {
///
/// If this method consumed `n > 0` bytes of `buf` it must return [`Ok(n)`].
/// If the return value is `Ok(n)` then `n` must satisfy `n <= buf.len()`.
/// Unless `buf` is empty, this function shouldn’t return `Ok(0)` since the
/// caller may interpret that as an error. To indicate lack of space,
/// implementors should return [`ErrorKind::StorageFull`] error instead.
/// A return value of `Ok(0)` typically means that the underlying object is
/// no longer able to accept bytes and will likely not be able to in the
/// future as well, or that the buffer provided is empty.
///
/// # Errors
///
Expand Down

0 comments on commit 4f14451

Please sign in to comment.