Skip to content

Conversation

@a1phyr
Copy link
Contributor

@a1phyr a1phyr commented Dec 1, 2025

Rewrite this function to help to compiler understand what is going on here.

@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 Dec 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 1, 2025

r? @joboet

rustbot has assigned @joboet.
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

@rust-log-analyzer

This comment has been minimized.

@joboet
Copy link
Member

joboet commented Dec 2, 2025

The downcast change looks fine, but I'm not convinced about the box removal being beneficial: wouldn't this increase the size of io::Result to three words instead of two?

@a1phyr
Copy link
Contributor Author

a1phyr commented Dec 3, 2025

Wow, I somehow managed to convince myself that the ErrorData enum was boxed in this case to make Error a single word...

Given the current situation, removing this box is probably not beneficial indeed. I'll remove the second commit.

@a1phyr a1phyr changed the title io::Error: avoid double-boxing of "custom" variant on 32 bits targets io::Error::downcast: avoid reallocation in case of failure Dec 3, 2025
@a1phyr a1phyr changed the title io::Error::downcast: avoid reallocation in case of failure Improve io::Error::downcast: Dec 3, 2025
@a1phyr a1phyr changed the title Improve io::Error::downcast: Improve io::Error::downcast Dec 3, 2025
@joboet
Copy link
Member

joboet commented Dec 3, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 3, 2025

📌 Commit 7de190a has been approved by joboet

It is now in the queue for this repository.

@bors bors 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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 3, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 3, 2025
Improve `io::Error::downcast`

Rewrite this function to help to compiler understand what is going on here.
bors added a commit that referenced this pull request Dec 3, 2025
Rollup of 9 pull requests

Successful merges:

 - #147841 (Fix ICE when applying test macro to crate root)
 - #149501 (CTFE: avoid emitting a hard error on generic normalization failures)
 - #149517 (Implement blessing for tidy alphabetical check)
 - #149521 (Improve `io::Error::downcast`)
 - #149545 (fix the check for which expressions read never type)
 - #149549 (Regression test for system register `ttbr0_el2`)
 - #149579 (Motor OS: fix compile error)
 - #149595 (Tidying up `tests/ui/issues` tests [2/N])
 - #149597 (Revert "implement and test `Iterator::{exactly_one, collect_array}`")

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Dec 4, 2025
Rollup of 9 pull requests

Successful merges:

 - #147841 (Fix ICE when applying test macro to crate root)
 - #149501 (CTFE: avoid emitting a hard error on generic normalization failures)
 - #149517 (Implement blessing for tidy alphabetical check)
 - #149521 (Improve `io::Error::downcast`)
 - #149545 (fix the check for which expressions read never type)
 - #149549 (Regression test for system register `ttbr0_el2`)
 - #149579 (Motor OS: fix compile error)
 - #149595 (Tidying up `tests/ui/issues` tests [2/N])
 - #149597 (Revert "implement and test `Iterator::{exactly_one, collect_array}`")

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Dec 4, 2025
Rollup of 10 pull requests

Successful merges:

 - #149521 (Improve `io::Error::downcast`)
 - #149544 (Only apply `no_mangle_const_items`'s suggestion to plain const items)
 - #149545 (fix the check for which expressions read never type)
 - #149570 (rename cortex-ar references to unified aarch32)
 - #149574 (Batched compiletest Config fixups)
 - #149579 (Motor OS: fix compile error)
 - #149595 (Tidying up `tests/ui/issues` tests [2/N])
 - #149597 (Revert "implement and test `Iterator::{exactly_one, collect_array}`")
 - #149608 (Allow PowerPC spe_acc as clobber-only register)
 - #149610 (Implement benchmarks for uN::{gather,scatter}_bits)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 170fffd into rust-lang:main Dec 4, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Dec 4, 2025
rust-timer added a commit that referenced this pull request Dec 4, 2025
Rollup merge of #149521 - a1phyr:improve_io_error, r=joboet

Improve `io::Error::downcast`

Rewrite this function to help to compiler understand what is going on here.
github-actions bot pushed a commit to rust-lang/compiler-builtins that referenced this pull request Dec 11, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#149521 (Improve `io::Error::downcast`)
 - rust-lang/rust#149544 (Only apply `no_mangle_const_items`'s suggestion to plain const items)
 - rust-lang/rust#149545 (fix the check for which expressions read never type)
 - rust-lang/rust#149570 (rename cortex-ar references to unified aarch32)
 - rust-lang/rust#149574 (Batched compiletest Config fixups)
 - rust-lang/rust#149579 (Motor OS: fix compile error)
 - rust-lang/rust#149595 (Tidying up `tests/ui/issues` tests [2/N])
 - rust-lang/rust#149597 (Revert "implement and test `Iterator::{exactly_one, collect_array}`")
 - rust-lang/rust#149608 (Allow PowerPC spe_acc as clobber-only register)
 - rust-lang/rust#149610 (Implement benchmarks for uN::{gather,scatter}_bits)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants