Skip to content

Commit

Permalink
Rollup merge of #86811 - soerenmeier:remove_remaining, r=yaahc
Browse files Browse the repository at this point in the history
Remove unstable `io::Cursor::remaining`

Adding `io::Cursor::remaining` in #86037 caused a conflict with the implementation of `bytes::Buf` for `io::Cursor`, leading to an error in nightly, see #86369 (comment).

This fixes the error by temporarily removing the `remaining` function.

r? `@yaahc`
  • Loading branch information
JohnTitor authored Jul 12, 2021
2 parents b507cd1 + 626bab5 commit 749a589
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions library/std/src/io/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,32 +209,6 @@ impl<T> Cursor<T>
where
T: AsRef<[u8]>,
{
/// Returns the remaining length.
///
/// # Examples
///
/// ```
/// #![feature(cursor_remaining)]
/// use std::io::Cursor;
///
/// let mut buff = Cursor::new(vec![1, 2, 3, 4, 5]);
///
/// assert_eq!(buff.remaining(), 5);
///
/// buff.set_position(2);
/// assert_eq!(buff.remaining(), 3);
///
/// buff.set_position(4);
/// assert_eq!(buff.remaining(), 1);
///
/// buff.set_position(6);
/// assert_eq!(buff.remaining(), 0);
/// ```
#[unstable(feature = "cursor_remaining", issue = "86369")]
pub fn remaining(&self) -> u64 {
(self.inner.as_ref().len() as u64).checked_sub(self.pos).unwrap_or(0)
}

/// Returns the remaining slice.
///
/// # Examples
Expand Down

0 comments on commit 749a589

Please sign in to comment.