Skip to content

Commit fc28478

Browse files
committed
allow BufReader::peek to be called on unsized types
1 parent 600edc9 commit fc28478

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/std/src/io/buffered/bufreader.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ impl<R: Read> BufReader<R> {
117117
/// assert_eq!(&s, "hello");
118118
/// ```
119119
#[unstable(feature = "bufreader_peek", issue = "128405")]
120-
pub fn peek(&mut self, n: usize) -> io::Result<&[u8]> {
120+
pub fn peek(&mut self, n: usize) -> io::Result<&[u8]>
121+
where
122+
R: ?Sized,
123+
{
121124
assert!(n <= self.capacity());
122125
while n > self.buf.buffer().len() {
123126
if self.buf.pos() > 0 {

0 commit comments

Comments
 (0)