Move std::io::copy to alloc::io#158548
Open
bushrat011899 wants to merge 10 commits into
Open
Conversation
Collaborator
|
r? @clarfonthey rustbot has assigned @clarfonthey. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
Author
|
@rustbot blocked |
4 tasks
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 2, 2026 02:01
1bcdfe1 to
43f67ba
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
2 times, most recently
from
July 3, 2026 03:50
90ec159 to
8139972
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 6, 2026 09:26
8139972 to
cb62676
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 6, 2026 21:51
cb62676 to
3bb0364
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 6, 2026 22:21
3bb0364 to
df9a018
Compare
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 7, 2026 05:28
df9a018 to
8f363d9
Compare
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 8, 2026 09:09
8f363d9 to
d331e98
Compare
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 10, 2026 05:26
d331e98 to
386eee0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 18, 2026 03:25
386eee0 to
fc0fada
Compare
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 18, 2026 21:35
fc0fada to
d6335a5
Compare
This comment has been minimized.
This comment has been minimized.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
2 times, most recently
from
July 19, 2026 21:54
875bdd0 to
f09db87
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 20, 2026 04:37
f09db87 to
58612c3
Compare
std::io::copy internals to alloc::iostd::io::copy to alloc::io
None of the currently public methods are accessible outside `std`, and are unused within. Therefore, they can be restricted to internal use.
Co-Authored-By: Clar Fon <15850505+clarfonthey@users.noreply.github.com>
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 20, 2026 05:21
58612c3 to
8ea8fc7
Compare
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Clar Fon <15850505+clarfonthey@users.noreply.github.com>
Co-Authored-By: Clar Fon <15850505+clarfonthey@users.noreply.github.com>
Rely on specialization to allow `std` to provide optimized copy implementations.
bushrat011899
force-pushed
the
alloc_io_copy_internals
branch
from
July 20, 2026 07:15
8ea8fc7 to
dd93f8e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
View all comments
ACP: rust-lang/libs-team#755
Tracking issue: #154046
Split From: #156527
Blocked On: #158547
Description
Moves
std::io::copyintoalloc::io. Blocked on #158547.This relies on specialization to allow
stdto provide optimised copy implementations for its types where appropriate. The exact technique involves defining a new trait,alloc::io::SpecCopy: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::copyfunction is generic over the reader specifically to allow wrappers likeTake<R>to be visible to the implementation ofcopy.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
alloc::ioandcore::io#154046 (comment) for a review order and broader context for this PR.