Skip to content

Commit 7e928ee

Browse files
authored
Unrolled build for rust-lang#117694
Rollup merge of rust-lang#117694 - jmillikin:core-io-borrowed-buf, r=m-ou-se Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io` Tracking issue: rust-lang#117693 ACP: rust-lang/libs-team#290
2 parents d8dbf7c + 341c856 commit 7e928ee

File tree

10 files changed

+31
-22
lines changed

10 files changed

+31
-22
lines changed

compiler/rustc_span/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2525
#![feature(array_windows)]
2626
#![feature(cfg_match)]
27+
#![feature(core_io_borrowed_buf)]
2728
#![feature(if_let_guard)]
2829
#![feature(let_chains)]
2930
#![feature(min_specialization)]

library/std/src/io/readbuf.rs library/core/src/io/borrowed_buf.rs

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
#![unstable(feature = "read_buf", issue = "78485")]
2-
3-
#[cfg(test)]
4-
mod tests;
1+
#![unstable(feature = "core_io_borrowed_buf", issue = "117693")]
52

63
use crate::fmt::{self, Debug, Formatter};
7-
use crate::io::{Result, Write};
84
use crate::mem::{self, MaybeUninit};
95
use crate::{cmp, ptr};
106

@@ -303,16 +299,3 @@ impl<'a> BorrowedCursor<'a> {
303299
self.buf.filled += buf.len();
304300
}
305301
}
306-
307-
impl<'a> Write for BorrowedCursor<'a> {
308-
fn write(&mut self, buf: &[u8]) -> Result<usize> {
309-
let amt = cmp::min(buf.len(), self.capacity());
310-
self.append(&buf[..amt]);
311-
Ok(amt)
312-
}
313-
314-
#[inline]
315-
fn flush(&mut self) -> Result<()> {
316-
Ok(())
317-
}
318-
}

library/core/src/io/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! Traits, helpers, and type definitions for core I/O functionality.
2+
3+
mod borrowed_buf;
4+
5+
#[unstable(feature = "core_io_borrowed_buf", issue = "117693")]
6+
pub use self::borrowed_buf::{BorrowedBuf, BorrowedCursor};

library/core/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ pub mod async_iter;
369369
pub mod cell;
370370
pub mod char;
371371
pub mod ffi;
372+
#[unstable(feature = "core_io_borrowed_buf", issue = "117693")]
373+
pub mod io;
372374
pub mod iter;
373375
pub mod net;
374376
pub mod option;

library/std/src/io/readbuf/tests.rs library/core/tests/io/borrowed_buf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use super::BorrowedBuf;
2-
use crate::mem::MaybeUninit;
1+
use core::io::BorrowedBuf;
2+
use core::mem::MaybeUninit;
33

44
/// Test that BorrowedBuf has the correct numbers when created with new
55
#[test]

library/core/tests/io/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mod borrowed_buf;

library/core/tests/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#![feature(const_likely)]
2424
#![feature(const_location_fields)]
2525
#![feature(core_intrinsics)]
26+
#![feature(core_io_borrowed_buf)]
2627
#![feature(core_private_bignum)]
2728
#![feature(core_private_diy_float)]
2829
#![feature(dec2flt)]
@@ -135,6 +136,7 @@ mod fmt;
135136
mod future;
136137
mod hash;
137138
mod intrinsics;
139+
mod io;
138140
mod iter;
139141
mod lazy;
140142
#[cfg(test)]

library/std/src/io/impls.rs

+14
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,17 @@ impl<A: Allocator> Write for VecDeque<u8, A> {
528528
Ok(())
529529
}
530530
}
531+
532+
#[unstable(feature = "read_buf", issue = "78485")]
533+
impl<'a> io::Write for core::io::BorrowedCursor<'a> {
534+
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
535+
let amt = cmp::min(buf.len(), self.capacity());
536+
self.append(&buf[..amt]);
537+
Ok(amt)
538+
}
539+
540+
#[inline]
541+
fn flush(&mut self) -> io::Result<()> {
542+
Ok(())
543+
}
544+
}

library/std/src/io/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ pub use self::{
330330
};
331331

332332
#[unstable(feature = "read_buf", issue = "78485")]
333-
pub use self::readbuf::{BorrowedBuf, BorrowedCursor};
333+
pub use core::io::{BorrowedBuf, BorrowedCursor};
334334
pub(crate) use error::const_io_error;
335335

336336
mod buffered;
@@ -339,7 +339,6 @@ mod cursor;
339339
mod error;
340340
mod impls;
341341
pub mod prelude;
342-
mod readbuf;
343342
mod stdio;
344343
mod util;
345344

library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@
310310
// tidy-alphabetical-start
311311
#![feature(char_internals)]
312312
#![feature(core_intrinsics)]
313+
#![feature(core_io_borrowed_buf)]
313314
#![feature(duration_constants)]
314315
#![feature(error_generic_member_access)]
315316
#![feature(error_in_core)]

0 commit comments

Comments
 (0)