Skip to content

Move std::io::Write to core::io#158541

Merged
rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
bushrat011899:core_io_write
Jul 10, 2026
Merged

Move std::io::Write to core::io#158541
rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
bushrat011899:core_io_write

Conversation

@bushrat011899

@bushrat011899 bushrat011899 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

View all comments

ACP: rust-lang/libs-team#755
Tracking issue: #154046
Split From: #156527
Blocked On: #158537
Blocked On: #158540

Description

Moves std::io::Write to core::io. This is effectively a direct cut and paste, but with a large diff due to how many implementations need to be moved into alloc and core. Blocked on #158537 and #158540.


Notes

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 29, 2026
@rustbot

rustbot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
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: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from 6 candidates

@bushrat011899

Copy link
Copy Markdown
Contributor Author

@rustbot blocked

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 29, 2026
@bushrat011899 bushrat011899 force-pushed the core_io_write branch 2 times, most recently from ec21a69 to c806329 Compare July 3, 2026 01:49
@rust-bors

This comment has been minimized.

@rustbot

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

@rustbot ready
@clarfonthey This is the next PR in my chain if you're interested in reviewing this one too! I'm not assigning you just in case you don't want to take it on.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Jul 6, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

r? clarfonthey

@rustbot rustbot assigned clarfonthey and unassigned Darksonn Jul 7, 2026
Comment thread library/core/src/io/write.rs
Comment thread library/core/src/io/cursor.rs Outdated
@bushrat011899 bushrat011899 requested a review from clarfonthey July 7, 2026 01:25
Comment thread library/alloc/src/io/impls.rs Outdated
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 9, 2026
…rfonthey

Move `std::io::Write` to `core::io`

ACP: rust-lang/libs-team#755
Tracking issue: rust-lang#154046
Split From: rust-lang#156527
~~Blocked On: rust-lang#158537
~~Blocked On: rust-lang#158540

## Description

Moves `std::io::Write` to `core::io`. This is effectively a direct cut and paste, but with a large diff due to how many implementations need to be moved into `alloc` and `core`. Blocked on rust-lang#158537 and rust-lang#158540.

---

## 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.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 9, 2026
…rfonthey

Move `std::io::Write` to `core::io`

ACP: rust-lang/libs-team#755
Tracking issue: rust-lang#154046
Split From: rust-lang#156527
~~Blocked On: rust-lang#158537
~~Blocked On: rust-lang#158540

## Description

Moves `std::io::Write` to `core::io`. This is effectively a direct cut and paste, but with a large diff due to how many implementations need to be moved into `alloc` and `core`. Blocked on rust-lang#158537 and rust-lang#158540.

---

## 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.
rust-bors Bot pushed a commit that referenced this pull request Jul 9, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #150946 (intrinsics: Add a fallback for non-const libm float functions)
 - #158510 (Enable `static_position_independent_executables` on all gnu and musl targets)
 - #158541 (Move `std::io::Write` to `core::io`)
 - #158899 (Fix `unaligned_volatile_store` by removing `MemFlags::UNALIGNED`)
 - #155429 (Support `u128`/`i128` c-variadic arguments)
 - #156370 (Reject linked dylib EII default overrides)
 - #156508 (Infer all anonymous lifetimes in assoc consts as `'static`)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158645 (Fix splat ICEs and ban it in closures)
 - #158859 (Improve `-Zls` diagnostic message on `.rs` files)
 - #158988 (Redo `TokenStreamIter`)
 - #158347 (Improve generic parameters handling for #[diagnostic::on_const])
 - #158722 (delegation: do not always inherit `ConstArgHasType` predicates)
 - #158739 (view-types: HIR lowering)
 - #158883 (tests: fix enum-match.rs to handle LLVM 23)
 - #158886 (Add documentation for the `no_std` attribute)
 - #158940 (Implement feature `char_to_u32`)
 - #158951 (Merge three `MaxUniverse`s into one)
 - #158961 (Reapply "LLVM 23: Run AssignGUIDPass in some places")
 - #158996 ([compiler] Implement `PartialOrd` via `Ord` for `Span` and newtype_indexes)
 - #159005 (Use `as_lang_item` instead of repeatedly matching)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 9, 2026
…rfonthey

Move `std::io::Write` to `core::io`

ACP: rust-lang/libs-team#755
Tracking issue: rust-lang#154046
Split From: rust-lang#156527
~~Blocked On: rust-lang#158537
~~Blocked On: rust-lang#158540

## Description

Moves `std::io::Write` to `core::io`. This is effectively a direct cut and paste, but with a large diff due to how many implementations need to be moved into `alloc` and `core`. Blocked on rust-lang#158537 and rust-lang#158540.

---

## 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.
rust-bors Bot pushed a commit that referenced this pull request Jul 9, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #150946 (intrinsics: Add a fallback for non-const libm float functions)
 - #158510 (Enable `static_position_independent_executables` on all gnu and musl targets)
 - #158541 (Move `std::io::Write` to `core::io`)
 - #158899 (Fix `unaligned_volatile_store` by removing `MemFlags::UNALIGNED`)
 - #156027 (Consider captured regions for opaque type region liveness.)
 - #156370 (Reject linked dylib EII default overrides)
 - #156508 (Infer all anonymous lifetimes in assoc consts as `'static`)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158645 (Fix splat ICEs and ban it in closures)
 - #158859 (Improve `-Zls` diagnostic message on `.rs` files)
 - #158988 (Redo `TokenStreamIter`)
 - #158347 (Improve generic parameters handling for #[diagnostic::on_const])
 - #158384 (Allow BackwardIncompatibleDropHint in polonius legacy)
 - #158722 (delegation: do not always inherit `ConstArgHasType` predicates)
 - #158739 (view-types: HIR lowering)
 - #158877 (borrowck: Keep returned `path` from `best_blame_constraint()` consistent)
 - #158883 (tests: fix enum-match.rs to handle LLVM 23)
 - #158886 (Add documentation for the `no_std` attribute)
 - #158940 (Implement feature `char_to_u32`)
 - #158951 (Merge three `MaxUniverse`s into one)
 - #158961 (Reapply "LLVM 23: Run AssignGUIDPass in some places")
 - #158995 (Use REST API in linkchecker script)
 - #158996 ([compiler] Implement `PartialOrd` via `Ord` for `Span` and newtype_indexes)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 9, 2026
…rfonthey

Move `std::io::Write` to `core::io`

ACP: rust-lang/libs-team#755
Tracking issue: rust-lang#154046
Split From: rust-lang#156527
~~Blocked On: rust-lang#158537
~~Blocked On: rust-lang#158540

## Description

Moves `std::io::Write` to `core::io`. This is effectively a direct cut and paste, but with a large diff due to how many implementations need to be moved into `alloc` and `core`. Blocked on rust-lang#158537 and rust-lang#158540.

---

## 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.
rust-bors Bot pushed a commit that referenced this pull request Jul 10, 2026
Rollup of 24 pull requests

Successful merges:

 - #150946 (intrinsics: Add a fallback for non-const libm float functions)
 - #158541 (Move `std::io::Write` to `core::io`)
 - #156027 (Consider captured regions for opaque type region liveness.)
 - #156370 (Reject linked dylib EII default overrides)
 - #156508 (Infer all anonymous lifetimes in assoc consts as `'static`)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158645 (Fix splat ICEs and ban it in closures)
 - #158859 (Improve `-Zls` diagnostic message on `.rs` files)
 - #158988 (Redo `TokenStreamIter`)
 - #158347 (Improve generic parameters handling for #[diagnostic::on_const])
 - #158384 (Allow BackwardIncompatibleDropHint in polonius legacy)
 - #158722 (delegation: do not always inherit `ConstArgHasType` predicates)
 - #158739 (view-types: HIR lowering)
 - #158877 (borrowck: Keep returned `path` from `best_blame_constraint()` consistent)
 - #158883 (tests: fix enum-match.rs to handle LLVM 23)
 - #158886 (Add documentation for the `no_std` attribute)
 - #158940 (Implement feature `char_to_u32`)
 - #158951 (Merge three `MaxUniverse`s into one)
 - #158960 (Fix bootstrap submodule path prefix matching)
 - #158961 (Reapply "LLVM 23: Run AssignGUIDPass in some places")
 - #158995 (Use REST API in linkchecker script)
 - #158996 ([compiler] Implement `PartialOrd` via `Ord` for `Span` and newtype_indexes)
 - #159036 (bootstrap: expand '@argfile' arguments to rustc shim)
@rust-bors rust-bors Bot merged commit 8ed2968 into rust-lang:main Jul 10, 2026
14 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 10, 2026
rust-timer added a commit that referenced this pull request Jul 10, 2026
Rollup merge of #158541 - bushrat011899:core_io_write, r=clarfonthey

Move `std::io::Write` to `core::io`

ACP: rust-lang/libs-team#755
Tracking issue: #154046
Split From: #156527
~~Blocked On: #158537
~~Blocked On: #158540

## Description

Moves `std::io::Write` to `core::io`. This is effectively a direct cut and paste, but with a large diff due to how many implementations need to be moved into `alloc` and `core`. Blocked on #158537 and #158540.

---

## 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.
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@rust-timer build 0ffdcdb

@rust-timer

Copy link
Copy Markdown
Collaborator

Missing artifact for sha 0ffdcdb2b658591abfb86086a931c3cb8227c0ce (https://ci-artifacts.rust-lang.org/rustc-builds/0ffdcdb2b658591abfb86086a931c3cb8227c0ce/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz); not built yet, try again later.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@rust-timer build 0ffdcdb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (0ffdcdb): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@rustbot label: -S-waiting-on-perf +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.5% [0.1%, 0.7%] 3
Regressions ❌
(secondary)
0.7% [0.0%, 1.3%] 2
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [-0.4%, 0.7%] 4

Max RSS (memory usage)

Results (primary -1.0%, secondary 0.3%)

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

mean range count
Regressions ❌
(primary)
3.5% [3.5%, 3.5%] 1
Regressions ❌
(secondary)
8.6% [8.5%, 8.6%] 2
Improvements ✅
(primary)
-2.5% [-3.4%, -1.9%] 3
Improvements ✅
(secondary)
-5.2% [-8.5%, -2.1%] 3
All ❌✅ (primary) -1.0% [-3.4%, 3.5%] 4

Cycles

Results (primary -3.2%, secondary -4.4%)

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)
- - 0
Improvements ✅
(primary)
-3.2% [-3.2%, -3.2%] 1
Improvements ✅
(secondary)
-4.4% [-6.7%, -2.1%] 2
All ❌✅ (primary) -3.2% [-3.2%, -3.2%] 1

Binary size

Results (primary -0.2%, secondary 0.0%)

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

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

Bootstrap: 490.768s -> 490.566s (-0.04%)
Artifact size: 389.74 MiB -> 389.77 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Jul 13, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Regressions seem real
@bushrat011899

@bushrat011899

Copy link
Copy Markdown
Contributor Author

@JonathanBrouwer interesting! This PR only moves 1 trait, a handful of private functions, and said trait's libcore and liballoc implementations. There's no changes to how the trait works or is implemented, so I can only assume the compiler itself just has to work harder when a trait is referenced across multiple crates? It might be worth checking #158544, which moves Read. If there's a compile time regression for Write, I'd expect to see the same thing in moving Read. The only difference is Read is only being moved to liballoc, so it'd be interesting to confirm that the same regression is seen.

@clarfonthey

Copy link
Copy Markdown
Contributor

Entirely possible that there are just some functions that should have been marked inline but weren't.

@clarfonthey

Copy link
Copy Markdown
Contributor

Not sure how perf triage likes to handle this, but I was planning to block merging further core::io changes until we can get some guarantee the perf doesn't regress, and we've fixed this.

I mention inlining since it's an obvious cross-crate thing that might apply here, but I don't actually know the cause and haven't properly looked.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

It would be nice if you could look into the regressions before continuing so we can at least understand where they come from. They're relatively small though so if they're discovered not to be solvable they shouldn't block progress imo

@clarfonthey

Copy link
Copy Markdown
Contributor

To be clear, "not regress" here mostly means that if it turns out to be a very weird rabbit hole that we can't fix, we can just let it be, but if it gets fixed by tweaking a few inline attributes or rearranging some code, we should definitely make those fixes first.

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

Labels

perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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.

7 participants