Skip to content

Commit febe988

Browse files
authored
Merge pull request #4338 from RalfJung/FileDescription
FileDescription: improve read/write docs
2 parents fe51193 + 0523554 commit febe988

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/tools/miri/src/shims/files.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ pub trait FileDescription: std::fmt::Debug + FileDescriptionExt {
135135

136136
/// Reads as much as possible into the given buffer `ptr`.
137137
/// `len` indicates how many bytes we should try to read.
138-
/// `dest` is where the return value should be stored: number of bytes read, or `-1` in case of error.
138+
///
139+
/// When the read is done, `finish` will be called. Note that `read` itself may return before
140+
/// that happens! Everything that should happen "after" the `read` needs to happen inside
141+
/// `finish`.
139142
fn read<'tcx>(
140143
self: FileDescriptionRef<Self>,
141144
_communicate_allowed: bool,
@@ -149,7 +152,10 @@ pub trait FileDescription: std::fmt::Debug + FileDescriptionExt {
149152

150153
/// Writes as much as possible from the given buffer `ptr`.
151154
/// `len` indicates how many bytes we should try to write.
152-
/// `dest` is where the return value should be stored: number of bytes written, or `-1` in case of error.
155+
///
156+
/// When the write is done, `finish` will be called. Note that `write` itself may return before
157+
/// that happens! Everything that should happen "after" the `write` needs to happen inside
158+
/// `finish`.
153159
fn write<'tcx>(
154160
self: FileDescriptionRef<Self>,
155161
_communicate_allowed: bool,

0 commit comments

Comments
 (0)