Move std::io::buffered to alloc::io - #158547
Conversation
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@rustbot blocked |
This comment has been minimized.
This comment has been minimized.
999bae7 to
ed009e7
Compare
This comment has been minimized.
This comment has been minimized.
dd63a8f to
bc8b452
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bc8b452 to
62c2a52
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
62c2a52 to
29b77fb
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
29b77fb to
a70a3c2
Compare
This comment has been minimized.
This comment has been minimized.
a70a3c2 to
f266f4c
Compare
This comment has been minimized.
This comment has been minimized.
f266f4c to
e5311db
Compare
This comment has been minimized.
This comment has been minimized.
Move `std::io::buffered` to `alloc::io`
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (b404afe): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 2.9%, secondary 0.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 485.673s -> 485.443s (-0.05%) |
|
@bors r+ rollup |
…=clarfonthey Move `std::io::buffered` to `alloc::io` ACP: rust-lang/libs-team#755 Tracking issue: rust-lang#154046 Split From: rust-lang#156527 ~~Blocked On: rust-lang#158546 ## Description Moves `std::io::BufReader`/`BufWriter`/`LineWriter`/etc. to `alloc::io`. This is effectively a direct cut and paste. Blocked on rust-lang#158546. --- ## Notes * No AI tooling of any kind was used during the creation of this PR. * Please see rust-lang#154046 (comment) for a review order and broader context for this PR.
…uwer Rollup of 7 pull requests Successful merges: - #159582 (Sync from portable simd 2026 07 20) - #157270 (ergonomic_clones_dotuse_capture_by_ref: Capture upvar by ref for `.use` in non-move closures) - #158496 (Move `check_rustc_pub_transparent` into the attribute parser) - #158547 (Move `std::io::buffered` to `alloc::io`) - #159505 (make rustdoc::bare_urls strip trailing periods from url) - #159578 (Extract coroutine closure helper functions) - #159613 (Set the rustc lib path for unstable-book-gen)
Rollup of 14 pull requests Successful merges: - #159307 (Improve cross-namespace name diagnostics) - #159543 (Remove extra semicolons in parsing item lists) - #157270 (ergonomic_clones_dotuse_capture_by_ref: Capture upvar by ref for `.use` in non-move closures) - #158496 (Move `check_rustc_pub_transparent` into the attribute parser) - #158547 (Move `std::io::buffered` to `alloc::io`) - #158808 (Filter host libstdc++ ABI flag in rustc_llvm cross builds) - #159362 (Add regression test for #120328) - #159472 (Support creating float constants in rustc_public mir) - #159505 (make rustdoc::bare_urls strip trailing periods from url) - #159568 (Suggest close compiler options) - #159578 (Extract coroutine closure helper functions) - #159601 (Make `TokenTreeCursor` private) - #159613 (Set the rustc lib path for unstable-book-gen) - #159616 (Clarify the comment about stage1/stage2 discrepancy in input-stats test)
Rollup merge of #158547 - bushrat011899:alloc_io_buffered, r=clarfonthey Move `std::io::buffered` to `alloc::io` ACP: rust-lang/libs-team#755 Tracking issue: #154046 Split From: #156527 ~~Blocked On: #158546 ## Description Moves `std::io::BufReader`/`BufWriter`/`LineWriter`/etc. to `alloc::io`. This is effectively a direct cut and paste. Blocked on #158546. --- ## Notes * No AI tooling of any kind was used during the creation of this PR. * Please see #154046 (comment) for a review order and broader context for this PR.
Rollup of 14 pull requests Successful merges: - rust-lang/rust#159307 (Improve cross-namespace name diagnostics) - rust-lang/rust#159543 (Remove extra semicolons in parsing item lists) - rust-lang/rust#157270 (ergonomic_clones_dotuse_capture_by_ref: Capture upvar by ref for `.use` in non-move closures) - rust-lang/rust#158496 (Move `check_rustc_pub_transparent` into the attribute parser) - rust-lang/rust#158547 (Move `std::io::buffered` to `alloc::io`) - rust-lang/rust#158808 (Filter host libstdc++ ABI flag in rustc_llvm cross builds) - rust-lang/rust#159362 (Add regression test for rust-lang/rust#120328) - rust-lang/rust#159472 (Support creating float constants in rustc_public mir) - rust-lang/rust#159505 (make rustdoc::bare_urls strip trailing periods from url) - rust-lang/rust#159568 (Suggest close compiler options) - rust-lang/rust#159578 (Extract coroutine closure helper functions) - rust-lang/rust#159601 (Make `TokenTreeCursor` private) - rust-lang/rust#159613 (Set the rustc lib path for unstable-book-gen) - rust-lang/rust#159616 (Clarify the comment about stage1/stage2 discrepancy in input-stats test)
rust-lang#158547 moved `std::io::BufWriter` to `alloc::io::BufWriter`. That allows it to be used in `no-std` configurations, and in particular on platforms where unwinding isn't supported. However one of the doc tests uses `catch_unwind`, which fails on platforms which cannot unwind. Fix this by copying the magic incantation from a similar doctest in library/core/src/range.rs
… r=clarfonthey Mark a doctest as requiring unwinding rust-lang#158547 moved `std::io::BufWriter` to `alloc::io::BufWriter`. That allows it to be used in `no-std` configurations, and in particular on platforms where unwinding isn't supported. However one of the doc tests uses `catch_unwind`, which fails on platforms which cannot unwind. Fix this by copying the magic incantation from a similar doctest in library/core/src/range.rs
… r=clarfonthey Mark a doctest as requiring unwinding rust-lang#158547 moved `std::io::BufWriter` to `alloc::io::BufWriter`. That allows it to be used in `no-std` configurations, and in particular on platforms where unwinding isn't supported. However one of the doc tests uses `catch_unwind`, which fails on platforms which cannot unwind. Fix this by copying the magic incantation from a similar doctest in library/core/src/range.rs
… r=clarfonthey Mark a doctest as requiring unwinding rust-lang#158547 moved `std::io::BufWriter` to `alloc::io::BufWriter`. That allows it to be used in `no-std` configurations, and in particular on platforms where unwinding isn't supported. However one of the doc tests uses `catch_unwind`, which fails on platforms which cannot unwind. Fix this by copying the magic incantation from a similar doctest in library/core/src/range.rs
… r=clarfonthey Mark a doctest as requiring unwinding rust-lang#158547 moved `std::io::BufWriter` to `alloc::io::BufWriter`. That allows it to be used in `no-std` configurations, and in particular on platforms where unwinding isn't supported. However one of the doc tests uses `catch_unwind`, which fails on platforms which cannot unwind. Fix this by copying the magic incantation from a similar doctest in library/core/src/range.rs
Rollup merge of #160151 - fs-rachel:unwind-in-alloc-doctest, r=clarfonthey Mark a doctest as requiring unwinding #158547 moved `std::io::BufWriter` to `alloc::io::BufWriter`. That allows it to be used in `no-std` configurations, and in particular on platforms where unwinding isn't supported. However one of the doc tests uses `catch_unwind`, which fails on platforms which cannot unwind. Fix this by copying the magic incantation from a similar doctest in library/core/src/range.rs
rust-lang#158547 moved `std::io::BufWriter` to `alloc::io::BufWriter`. That allows it to be used in `no-std` configurations, and in particular on platforms where unwinding isn't supported. However one of the doc tests uses `catch_unwind`, which fails on platforms which cannot unwind. Fix this by copying the magic incantation from a similar doctest in library/core/src/range.rs
…als, r=clarfonthey Move `std::io::copy` to `alloc::io` ACP: rust-lang/libs-team#755 Tracking issue: rust-lang#154046 Split From: rust-lang#156527 ~~Blocked On: rust-lang#158547 ## Description Moves `std::io::copy` into `alloc::io`. Blocked on rust-lang#158547. This relies on specialization to allow `std` to provide optimised copy implementations for its types where appropriate. The exact technique involves defining a new trait, `alloc::io::SpecCopy`: ```rust #[doc(hidden)] #[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")] #[rustc_specialization_trait] pub trait SpecCopy: Read { /// Attempt to copy from this reader to the provided writer using a specialized /// process. fn copy<R: Read + ?Sized, W: Write + ?Sized>( _reader: &mut R, _writer: &mut W, ) -> Result<CopyState>; } ``` Since optimised copying requires both the reader and writer to support the operation between each other, we can choose one of them to be the implementer of the copy algorithm, and delegate specialization to it. In this case, I've chosen the reader to be the provider of the specialized copy implementation arbitrarily. Note that the `SpecCopy::copy` function is generic over the reader specifically to allow wrappers like `Take<R>` to be visible to the implementation of `copy`. Because this introduces a new layer of specialization to `io::copy`, I think this PR should be benchmarked to make sure performance characteristics aren't too different. I am expecting compilation time to be slightly worse, since there's just more specialization happening, but the actual code run _should_ be the same. --- ## Notes * No AI tooling of any kind was used during the creation of this PR. * Please see rust-lang#154046 (comment) for a review order and broader context for this PR.
Rollup merge of #158548 - bushrat011899:alloc_io_copy_internals, r=clarfonthey Move `std::io::copy` to `alloc::io` ACP: rust-lang/libs-team#755 Tracking issue: #154046 Split From: #156527 ~~Blocked On: #158547 ## Description Moves `std::io::copy` into `alloc::io`. Blocked on #158547. This relies on specialization to allow `std` to provide optimised copy implementations for its types where appropriate. The exact technique involves defining a new trait, `alloc::io::SpecCopy`: ```rust #[doc(hidden)] #[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")] #[rustc_specialization_trait] pub trait SpecCopy: Read { /// Attempt to copy from this reader to the provided writer using a specialized /// process. fn copy<R: Read + ?Sized, W: Write + ?Sized>( _reader: &mut R, _writer: &mut W, ) -> Result<CopyState>; } ``` Since optimised copying requires both the reader and writer to support the operation between each other, we can choose one of them to be the implementer of the copy algorithm, and delegate specialization to it. In this case, I've chosen the reader to be the provider of the specialized copy implementation arbitrarily. Note that the `SpecCopy::copy` function is generic over the reader specifically to allow wrappers like `Take<R>` to be visible to the implementation of `copy`. Because this introduces a new layer of specialization to `io::copy`, I think this PR should be benchmarked to make sure performance characteristics aren't too different. I am expecting compilation time to be slightly worse, since there's just more specialization happening, but the actual code run _should_ be the same. --- ## Notes * No AI tooling of any kind was used during the creation of this PR. * Please see #154046 (comment) for a review order and broader context for this PR.
View all comments
ACP: rust-lang/libs-team#755
Tracking issue: #154046
Split From: #156527
Blocked On: #158546Description
Moves
std::io::BufReader/BufWriter/LineWriter/etc. toalloc::io. This is effectively a direct cut and paste. Blocked on #158546.Notes
alloc::ioandcore::io#154046 (comment) for a review order and broader context for this PR.