-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
The code is quite self-explaining:
rust/library/std/src/io/mod.rs
Lines 1835 to 1847 in a7e8fe7
fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { | |
while !buf.is_empty() { | |
match self.write(buf) { | |
Ok(0) => { | |
return Err(Error::WRITE_ALL_EOF); | |
} | |
Ok(n) => buf = &buf[n..], | |
Err(ref e) if e.is_interrupted() => {} | |
Err(e) => return Err(e), | |
} | |
} | |
Ok(()) | |
} |
However, reading the write() docs, I see no justification for this. As far as I can tell, write
is allowed to spuriously return 0 as a form of "short write". This random website also says so.
Cc @the8472
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.