From 6d34a2e0074c5ce3e0da4743616ec5b3e96253fb Mon Sep 17 00:00:00 2001 From: Aris Merchant <22333129+inquisitivecrystal@users.noreply.github.com> Date: Thu, 1 Jul 2021 15:07:09 -0700 Subject: [PATCH] Stabilize `Seek::rewind` --- library/std/src/io/mod.rs | 3 +-- library/std/src/io/tests.rs | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index 00b85604a3f67..594cef27b4138 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -1736,7 +1736,6 @@ pub trait Seek { /// # Example /// /// ```no_run - /// #![feature(seek_rewind)] /// use std::io::{Read, Seek, Write}; /// use std::fs::OpenOptions; /// @@ -1754,7 +1753,7 @@ pub trait Seek { /// f.read_to_string(&mut buf).unwrap(); /// assert_eq!(&buf, hello); /// ``` - #[unstable(feature = "seek_rewind", issue = "85149")] + #[stable(feature = "seek_rewind", since = "1.55.0")] fn rewind(&mut self) -> Result<()> { self.seek(SeekFrom::Start(0))?; Ok(()) diff --git a/library/std/src/io/tests.rs b/library/std/src/io/tests.rs index b73bcf85fbee2..1beb72a9a5072 100644 --- a/library/std/src/io/tests.rs +++ b/library/std/src/io/tests.rs @@ -336,6 +336,10 @@ fn seek_position() -> io::Result<()> { assert_eq!(c.stream_position()?, 8); assert_eq!(c.stream_position()?, 8); + c.rewind()?; + assert_eq!(c.stream_position()?, 0); + assert_eq!(c.stream_position()?, 0); + Ok(()) }