Move std::io::Error into core#155625
Conversation
This comment has been minimized.
This comment has been minimized.
b86f41f to
c538e5d
Compare
This comment has been minimized.
This comment has been minimized.
6c37f53 to
65d4011
Compare
This comment has been minimized.
This comment has been minimized.
65d4011 to
56a8e8c
Compare
93b1fa3 to
d3835aa
Compare
This comment has been minimized.
This comment has been minimized.
|
example of how to link from |
d3835aa to
8bfceb6
Compare
That's a clever trick I never knew about! Looks like it's also required for linking to incoherent implementations even within the file that creates them too. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8bfceb6 to
96864eb
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
96864eb to
7cad458
Compare
This comment has been minimized.
This comment has been minimized.
maybe just leave it until you get the PR to work, that way there's less comment spam. |
This comment has been minimized.
This comment has been minimized.
7cad458 to
0f0a783
Compare
0f0a783 to
e4ed737
Compare
std::io::Error into corestd::io::Error into core
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
…ref, r=jhpratt Generalize IO Traits for `Arc<T>` where `&T: IoTrait` ACP: rust-lang/libs-team#755 Tracking issue: rust-lang#154046 Related: rust-lang#94744 ## Description After experimenting with rust-lang#155625, I noticed `Seek` and `SeekFrom` can almost be moved to `core::io`. Unfortunately, the implementation of `Seek` for `Arc<File>` is a blocker for such a move, since `Arc` is not a fundamental type. This PR attempts to resolve this potential blocker by replacing the implementation with a more general alternative. An internal trait `IoHandle` has been added which types can implement to opt-in to `Read`/`Write`/`Seek` implementations for `Arc<Self>` as long as `&Self` implements said trait. Note that `BufRead` is excluded as the signature for `fill_buf` would require returning from a temporary. Since this "blanket" implementation only applies to a single type which already implements the same traits, I believe this should have no user-facing impact. If this PR was merged, rust-lang#134190 could be replaced with a 2 line PR: ```rust impl IoHandle for TcpStream {} impl IoHandle for UnixStream {} ``` Likewise for any other types, a table of which can be found [here](rust-lang/libs-team#504 (comment)). This is out of scope for this PR to avoid the need for an ACP. --- ## Notes * See [this comment](rust-lang#154046 (comment)) for further details. * No AI tooling of any kind was used during the creation of this PR.
Rollup merge of #155684 - bushrat011899:blanket_io_seek_for_ref, r=jhpratt Generalize IO Traits for `Arc<T>` where `&T: IoTrait` ACP: rust-lang/libs-team#755 Tracking issue: #154046 Related: #94744 ## Description After experimenting with #155625, I noticed `Seek` and `SeekFrom` can almost be moved to `core::io`. Unfortunately, the implementation of `Seek` for `Arc<File>` is a blocker for such a move, since `Arc` is not a fundamental type. This PR attempts to resolve this potential blocker by replacing the implementation with a more general alternative. An internal trait `IoHandle` has been added which types can implement to opt-in to `Read`/`Write`/`Seek` implementations for `Arc<Self>` as long as `&Self` implements said trait. Note that `BufRead` is excluded as the signature for `fill_buf` would require returning from a temporary. Since this "blanket" implementation only applies to a single type which already implements the same traits, I believe this should have no user-facing impact. If this PR was merged, #134190 could be replaced with a 2 line PR: ```rust impl IoHandle for TcpStream {} impl IoHandle for UnixStream {} ``` Likewise for any other types, a table of which can be found [here](rust-lang/libs-team#504 (comment)). This is out of scope for this PR to avoid the need for an ACP. --- ## Notes * See [this comment](#154046 (comment)) for further details. * No AI tooling of any kind was used during the creation of this PR.
Viewing internals wont be possible from `std` once moved into `core`.
e4ed737 to
4fe06e6
Compare
|
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. |
…pratt Generalize IO Traits for `Arc<T>` where `&T: IoTrait` ACP: rust-lang/libs-team#755 Tracking issue: rust-lang/rust#154046 Related: rust-lang/rust#94744 ## Description After experimenting with rust-lang/rust#155625, I noticed `Seek` and `SeekFrom` can almost be moved to `core::io`. Unfortunately, the implementation of `Seek` for `Arc<File>` is a blocker for such a move, since `Arc` is not a fundamental type. This PR attempts to resolve this potential blocker by replacing the implementation with a more general alternative. An internal trait `IoHandle` has been added which types can implement to opt-in to `Read`/`Write`/`Seek` implementations for `Arc<Self>` as long as `&Self` implements said trait. Note that `BufRead` is excluded as the signature for `fill_buf` would require returning from a temporary. Since this "blanket" implementation only applies to a single type which already implements the same traits, I believe this should have no user-facing impact. If this PR was merged, rust-lang/rust#134190 could be replaced with a 2 line PR: ```rust impl IoHandle for TcpStream {} impl IoHandle for UnixStream {} ``` Likewise for any other types, a table of which can be found [here](rust-lang/libs-team#504 (comment)). This is out of scope for this PR to avoid the need for an ACP. --- ## Notes * See [this comment](rust-lang/rust#154046 (comment)) for further details. * No AI tooling of any kind was used during the creation of this PR.
View all comments
ACP: rust-lang/libs-team#755
Tracking issue: #154046
Related: #155574
Related: #152918
Description
Moves
std::io::Errorintocore, deferringBox-adjacent methods to incoherent implementations inalloc, andRawOsErrormethods tostd. This requires some substantial changes to the internals ofError, but none of them are breaking changes or externally visible.Notably, I've replaced usage of
Boxwith a wrapper around a pointer and an appropriate drop function. This requires the addition of quite a few lines of unsafe, but is required to work aroundBoxonly being accessible fromalloc. Additionally, an atomic pointer to a VTable is used for working withRawOsErrorincore, since we cannot know the required implementations withoutstd.Notes
std::iotoalloc#152918std::io::RawOsErrortocore::io#155574