Skip to content

Commit

Permalink
Unrolled build for rust-lang#122512
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#122512 - baitcode:2024-03-14-buffer-documentation-fix, r=Nilstrieb

Cursor.rs documentation fix

Reason:

I've been learning Rust std library and got confused. Seek trait documentation clearly states that negative indexes will cause an error. And the code in the Cursor example uses negative index. I found myself trying to understand what am I missing until I've actually executed the code and got error. I decided to submit small fix to the documentation.
  • Loading branch information
rust-timer authored Mar 15, 2024
2 parents c5b5713 + 07e0182 commit 82ed6ec
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/std/src/io/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, SeekFrom};
/// // We might want to use a BufReader here for efficiency, but let's
/// // keep this example focused.
/// let mut file = File::create("foo.txt")?;
/// // First, we need to allocate 10 bytes to be able to write into.
/// file.set_len(10)?;
///
/// write_ten_bytes_at_end(&mut file)?;
/// # Ok(())
Expand Down

0 comments on commit 82ed6ec

Please sign in to comment.