Files
rust/library/std/src
Jacob Pratt e002c6c726 Rollup merge of #155684 - bushrat011899:blanket_io_seek_for_ref, r=jhpratt
Generalize IO Traits for `Arc<T>` where `&T: IoTrait`

ACP: https://github.com/rust-lang/libs-team/issues/755
Tracking issue: https://github.com/rust-lang/rust/issues/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](https://github.com/rust-lang/libs-team/issues/504#issuecomment-2539569736). This is out of scope for this PR to avoid the need for an ACP.

---

## Notes

* See [this comment](https://github.com/rust-lang/rust/issues/154046#issuecomment-4303975612) for further details.
* No AI tooling of any kind was used during the creation of this PR.
2026-04-24 02:42:49 -04:00
..
2026-04-24 14:26:09 +10:00
2026-04-18 11:23:14 +04:00
2026-04-16 14:11:28 -07:00
2026-04-14 18:09:15 -04:00
2026-04-21 09:26:25 -07:00
2026-01-11 16:39:18 +03:00
2025-01-11 06:35:21 +02:00
2026-03-10 00:05:20 +01:00
2026-04-24 14:26:09 +10:00
2026-04-20 18:38:25 +10:00
2026-04-22 17:41:52 +00:00
2026-02-23 13:13:27 +01:00
2025-02-07 16:54:07 +01:00