Skip to content

Commit 4f03195

Browse files
authored
Unrolled build for rust-lang#122276
Rollup merge of rust-lang#122276 - RalfJung:io-read, r=Nilstrieb io::Read trait: make it more clear when we are adressing implementations vs callers Inspired by [this](rust-lang#72186 (comment)) comment. For some reason we only have that `buf` warning in `read` and `read_exact`, even though it affects a bunch of other functions of this trait as well. It doesn't seem worth copy-pasting the same text everywhere though so I did not change this.
2 parents 3b1717c + 93049be commit 4f03195

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

library/std/src/io/mod.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,9 @@ pub trait Read {
692692
/// Callers have to ensure that no unchecked out-of-bounds accesses are possible even if
693693
/// `n > buf.len()`.
694694
///
695-
/// No guarantees are provided about the contents of `buf` when this
696-
/// function is called, so implementations cannot rely on any property of the
697-
/// contents of `buf` being true. It is recommended that *implementations*
698-
/// only write data to `buf` instead of reading its contents.
695+
/// *Implementations* of this method can make no assumptions about the contents of `buf` when
696+
/// this function is called. It is recommended that implementations only write data to `buf`
697+
/// instead of reading its contents.
699698
///
700699
/// Correspondingly, however, *callers* of this method in unsafe code must not assume
701700
/// any guarantees about how the implementation uses `buf`. The trait is safe to implement,
@@ -901,12 +900,10 @@ pub trait Read {
901900
/// This function reads as many bytes as necessary to completely fill the
902901
/// specified buffer `buf`.
903902
///
904-
/// No guarantees are provided about the contents of `buf` when this
905-
/// function is called, so implementations cannot rely on any property of the
906-
/// contents of `buf` being true. It is recommended that implementations
907-
/// only write data to `buf` instead of reading its contents. The
908-
/// documentation on [`read`] has a more detailed explanation on this
909-
/// subject.
903+
/// *Implementations* of this method can make no assumptions about the contents of `buf` when
904+
/// this function is called. It is recommended that implementations only write data to `buf`
905+
/// instead of reading its contents. The documentation on [`read`] has a more detailed
906+
/// explanation of this subject.
910907
///
911908
/// # Errors
912909
///

0 commit comments

Comments
 (0)