about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorJosh Stone <cuviper@gmail.com>2023-08-17 15:40:08 -0700
committerGitHub <noreply@github.com>2023-08-17 15:40:08 -0700
commit4f14451d7ca4265be1b39c7f4ec63fb28ff6bc70 (patch)
tree6919b9c210b4be2867dc5ebe2e54b14c0447d67e /library/std
parentcd50556e9089b6df803bae616b58acd4f0b6a4c4 (diff)
parent5210f482d7309004c0ff3f6306f052f8d5adb67b (diff)
downloadrust-4f14451d7ca4265be1b39c7f4ec63fb28ff6bc70.tar.gz
rust-4f14451d7ca4265be1b39c7f4ec63fb28ff6bc70.zip
Rollup merge of #114897 - joshtriplett:partial-revert-ok-0, r=m-ou-se
Partially revert #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.
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/io/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index 5c1d2d8f46c..71d91f21362 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -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
     ///