close
Skip to content

Move IoSlice and IoSliceMut to core::io#155849

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
bushrat011899:io_slice_in_core
May 30, 2026
Merged

Move IoSlice and IoSliceMut to core::io#155849
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
bushrat011899:io_slice_in_core

Conversation

@bushrat011899
Copy link
Copy Markdown
Contributor

@bushrat011899 bushrat011899 commented Apr 27, 2026

View all comments

ACP: rust-lang/libs-team#755
Tracking issue: #154046
Related: #152918
Related: #155625

Description

Moves std::io::IoSlice and std::io::IoSliceMut into core::io. This is required for the Read and Write traits to be moved into alloc and/or core, as they contain stable methods which work with IO slices. Similar to #155574, this PR inlines the std::sys types required to create an ABI compatible type for the platforms where such compatibility is guaranteed.

Additionally, I've moved the relevant tests out of std::io::tests into coretests::io::io_slice.


Notes

  • This PR overlaps with Move OS-dependent parts of std::io to alloc #152918, but goes further than moving the IO slice types to alloc and instead moves them straight to core. Since these types have no interaction with allocation, and doing so will allow Write to move to core::io, I consider this a better home for these types.
  • Some discussion around the decision to not use a core::sys module can be found here.
  • I've renamed unsupported to generic to better reflect that IoSlice(Mut) is supported by all platforms, it just doesn't have a special ABI-compatible type. I don't want to imply that parts of core "don't work" depending on the target; IoSlice(Mut) works exactly as expected on all targets.
  • I've made pub items within each platform-specific representation pub(super) to highlight that everything within core::io::io_slice is an internal implementation detail not meant for any other part of the crate to be aware of.
  • No AI tooling of any kind was used during the creation of this PR.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 27, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 27, 2026

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt, scottmcm

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lygstate
Copy link
Copy Markdown
Contributor

a long awating staff, thanks.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bushrat011899

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@bushrat011899
Copy link
Copy Markdown
Contributor Author

I've split this PR into 3 commits to better highlight how little actually changes in order to facilitate this move. For reviewers, I recommend going through each commit individually.

@jhpratt
Copy link
Copy Markdown
Member

jhpratt commented May 13, 2026

As a heads up, I am currently exploring Europe and won't be home for a couple more weeks. If you'd like a review before then, feel free to reroll.

@bushrat011899
Copy link
Copy Markdown
Contributor Author

bushrat011899 commented May 13, 2026

As a heads up, I am currently exploring Europe and won't be home for a couple more weeks. If you'd like a review before then, feel free to reroll.

Thanks for the heads up, hope you have a great time!

r? libs

@rustbot

This comment was marked as outdated.

@nia-e
Copy link
Copy Markdown
Member

nia-e commented May 13, 2026

I will probably also take a day or two before I can get to this, but given the stuff it's touching it's likely worth a perf run:

@bors try @rust-timer queue

rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
Move `IoSlice` and `IoSliceMut` to `core::io`





ACP: rust-lang/libs-team#755
Tracking issue: #154046
Related: #152918
Related: #155625

## Description

Moves `std::io::IoSlice` and `std::io::IoSliceMut` into `core::io`. This is required for the `Read` and `Write` traits to be moved into `alloc` and/or `core`, as they contain stable methods which work with IO slices. Similar to #155574, this PR inlines the `std::sys` types required to create an ABI compatible type for the platforms where such compatibility is guaranteed.

Additionally, I've moved the relevant tests out of `std::io::tests` into `coretests::io::io_slice`.

---

## Notes

* This PR overlaps with #152918, but goes further than moving the IO slice types to `alloc` and instead moves them straight to `core`. Since these types have no interaction with allocation, and doing so will allow `Write` to move to `core::io`, I consider this a better home for these types.
* Some discussion around the decision to not use a `core::sys` module can be found [here](#155574 (comment)).
* I've renamed `unsupported` to `generic` to better reflect that `IoSlice(Mut)` _is_ supported by all platforms, it just doesn't have a special ABI-compatible type. I don't want to imply that parts of `core` "don't work" depending on the target; `IoSlice(Mut)` works exactly as expected on all targets.
* I've made `pub` items within each platform-specific representation `pub(super)` to highlight that everything within `core::io::io_slice` is an internal implementation detail not meant for any other part of the crate to be aware of.
* No AI tooling of any kind was used during the creation of this PR.
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 29, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 29, 2026

💔 Test for 27478a4 failed: CI. Failed job:

@nia-e
Copy link
Copy Markdown
Member

nia-e commented May 29, 2026

Let's do a try build after this is fixed.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 29, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@programmerjake
Copy link
Copy Markdown
Member

programmerjake commented May 29, 2026

Let's do a try build after this is fixed.

GitHub is being broken again, I can't see the logs where it failed since GitHub refuses to show the full logs and the show raw logs link 404s, they're stuck in the LLVM build portion (which is a GitHub problem, not a building-LLVM problem).

So, maybe we should do a try build now in hopes of actually getting some logs with which to deduce the problem.

@nia-e
Copy link
Copy Markdown
Member

nia-e commented May 29, 2026

@bors try jobs=dist-x86_64-apple

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
Move `IoSlice` and `IoSliceMut` to `core::io`


try-job: dist-x86_64-apple
@nia-e

This comment has been minimized.

@lygstate

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 29, 2026

☀️ Try build successful (CI)
Build commit: cc23296 (cc23296b0fd1d5a951df2b72a3c201a89d6d3b98, parent: b5d1746e7d25465729706ac5a0004b035e219d01)

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@bors retry
If github refuses to show logs feel free to just immediately retry, it's a github problem then

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 30, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 30, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 30, 2026

☀️ Test successful - CI
Approved by: nia-e
Duration: 3h 16m 48s
Pushing c58275e to main...

@rust-bors rust-bors Bot merged commit c58275e into rust-lang:main May 30, 2026
14 checks passed
@rustbot rustbot added this to the 1.98.0 milestone May 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing a857d06 (parent) -> c58275e (this PR)

Test differences

Show 198 test diffs

Stage 1

  • io::tests::io_slice_advance_slices: pass -> [missing] (J0)
  • io::tests::io_slice_advance_slices_beyond_total_length: pass -> [missing] (J0)
  • io::tests::io_slice_advance_slices_empty_slice: pass -> [missing] (J0)
  • io::tests::io_slice_as_slice: pass -> [missing] (J0)
  • io::tests::io_slice_into_slice: pass -> [missing] (J0)
  • io::tests::io_slice_mut_advance_slices: pass -> [missing] (J0)
  • io::tests::io_slice_mut_advance_slices_beyond_total_length: pass -> [missing] (J0)
  • io::tests::io_slice_mut_advance_slices_empty_slice: pass -> [missing] (J0)
  • io::io_slice::io_slice_advance_slices: [missing] -> pass (J2)
  • io::io_slice::io_slice_advance_slices_beyond_total_length: [missing] -> pass (J2)
  • io::io_slice::io_slice_advance_slices_empty_slice: [missing] -> pass (J2)
  • io::io_slice::io_slice_as_slice: [missing] -> pass (J2)
  • io::io_slice::io_slice_into_slice: [missing] -> pass (J2)
  • io::io_slice::io_slice_mut_advance_slices: [missing] -> pass (J2)
  • io::io_slice::io_slice_mut_advance_slices_beyond_total_length: [missing] -> pass (J2)
  • io::io_slice::io_slice_mut_advance_slices_empty_slice: [missing] -> pass (J2)

Stage 2

  • io::io_slice::io_slice_advance_slices: [missing] -> pass (J1)
  • io::io_slice::io_slice_advance_slices_beyond_total_length: [missing] -> pass (J1)
  • io::io_slice::io_slice_advance_slices_empty_slice: [missing] -> pass (J1)
  • io::io_slice::io_slice_as_slice: [missing] -> pass (J1)
  • io::io_slice::io_slice_into_slice: [missing] -> pass (J1)
  • io::io_slice::io_slice_mut_advance_slices: [missing] -> pass (J1)
  • io::io_slice::io_slice_mut_advance_slices_beyond_total_length: [missing] -> pass (J1)
  • io::io_slice::io_slice_mut_advance_slices_empty_slice: [missing] -> pass (J1)
  • io::tests::io_slice_advance_slices: pass -> [missing] (J1)
  • io::tests::io_slice_advance_slices_beyond_total_length: pass -> [missing] (J1)
  • io::tests::io_slice_advance_slices_empty_slice: pass -> [missing] (J1)
  • io::tests::io_slice_as_slice: pass -> [missing] (J1)
  • io::tests::io_slice_into_slice: pass -> [missing] (J1)
  • io::tests::io_slice_mut_advance_slices: pass -> [missing] (J1)
  • io::tests::io_slice_mut_advance_slices_beyond_total_length: pass -> [missing] (J1)
  • io::tests::io_slice_mut_advance_slices_empty_slice: pass -> [missing] (J1)

Additionally, 166 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard c58275e0369d09fc3959b8ba87dcbcbe73797465 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-gcc-core-tests: 14m 52s -> 7m 43s (-48.0%)
  2. dist-x86_64-apple: 1h 39m -> 2h 19m (+39.6%)
  3. dist-i686-linux: 1h 49m -> 1h 6m (-39.6%)
  4. x86_64-msvc-2: 1h 53m -> 2h 25m (+28.6%)
  5. x86_64-msvc-ext1: 2h 20m -> 1h 41m (-28.1%)
  6. dist-x86_64-mingw: 2h 1m -> 2h 34m (+27.6%)
  7. dist-sparcv9-solaris: 1h 13m -> 1h 31m (+24.2%)
  8. dist-s390x-linux: 1h 14m -> 1h 31m (+22.9%)
  9. dist-x86_64-llvm-mingw: 1h 35m -> 1h 56m (+22.1%)
  10. x86_64-gnu-gcc: 55m 4s -> 1h 6m (+21.0%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (c58275e): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -3.0%, secondary 1.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
1.5% [1.3%, 1.6%] 4
Improvements ✅
(primary)
-6.8% [-6.8%, -6.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.0% [-6.8%, 0.8%] 2

Cycles

Results (secondary -1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.9% [-3.6%, -2.1%] 2
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 523.807s -> 515.367s (-1.61%)
Artifact size: 400.75 MiB -> 400.82 MiB (0.02%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants