diff options
| author | Josh Triplett <josh@joshtriplett.org> | 2025-04-15 10:54:08 -0700 |
|---|---|---|
| committer | Josh Triplett <josh@joshtriplett.org> | 2025-04-15 10:54:08 -0700 |
| commit | 043c5ff98262409a9c338001200c4cf2a66e72c8 (patch) | |
| tree | 66c40bde44fce51765b5655303301b53b39baa66 | |
| parent | 40dacd50b7074783db748d73925ac5c3693a7ec1 (diff) | |
Add warning comment to `Take::get_ref` and `Chain::get_ref`
The methods `Take::get_mut` and `Chain::get_mut` include comments warning about modifying the I/O state of the underlying reader. However, many readers (e.g. `File`) allow I/O using a shared reference (e.g. `&File`). So, add the same caveat to the `get_ref` methods.
| -rw-r--r-- | library/std/src/io/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index b6545eada86..5242261cf93 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -2658,6 +2658,10 @@ impl<T, U> Chain<T, U> { /// Gets references to the underlying readers in this `Chain`. /// + /// Care should be taken to avoid modifying the internal I/O state of the + /// underlying readers as doing so may corrupt the internal state of this + /// `Chain`. + /// /// # Examples /// /// ```no_run @@ -2915,6 +2919,10 @@ impl<T> Take<T> { /// Gets a reference to the underlying reader. /// + /// Care should be taken to avoid modifying the internal I/O state of the + /// underlying reader as doing so may corrupt the internal limit of this + /// `Take`. + /// /// # Examples /// /// ```no_run |
