Skip to content

Commit 2bc7d4d

Browse files
authored
Rollup merge of rust-lang#86794 - inquisitivecrystal:seek-rewind, r=m-ou-se
Stabilize `Seek::rewind()` This stabilizes `Seek::rewind`. It seemed to fit into one of the existing tests, so I extended that test rather than adding a new one. Closes rust-lang#85149.
2 parents 1ca3205 + 6d34a2e commit 2bc7d4d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: library/std/src/io/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,6 @@ pub trait Seek {
17591759
/// # Example
17601760
///
17611761
/// ```no_run
1762-
/// #![feature(seek_rewind)]
17631762
/// use std::io::{Read, Seek, Write};
17641763
/// use std::fs::OpenOptions;
17651764
///
@@ -1777,7 +1776,7 @@ pub trait Seek {
17771776
/// f.read_to_string(&mut buf).unwrap();
17781777
/// assert_eq!(&buf, hello);
17791778
/// ```
1780-
#[unstable(feature = "seek_rewind", issue = "85149")]
1779+
#[stable(feature = "seek_rewind", since = "1.55.0")]
17811780
fn rewind(&mut self) -> Result<()> {
17821781
self.seek(SeekFrom::Start(0))?;
17831782
Ok(())

Diff for: library/std/src/io/tests.rs

+4
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ fn seek_position() -> io::Result<()> {
336336
assert_eq!(c.stream_position()?, 8);
337337
assert_eq!(c.stream_position()?, 8);
338338

339+
c.rewind()?;
340+
assert_eq!(c.stream_position()?, 0);
341+
assert_eq!(c.stream_position()?, 0);
342+
339343
Ok(())
340344
}
341345

0 commit comments

Comments
 (0)