Add Read, Write and Seek impls for Arc<T> where appropriate#94744
Add Read, Write and Seek impls for Arc<T> where appropriate#94744tbu- wants to merge 1 commit intorust-lang:masterfrom
Read, Write and Seek impls for Arc<T> where appropriate#94744Conversation
If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. Fix rust-lang#53835.
|
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
|
This is incorrect, or at least has very surprising behaviour, if But this impl will create a new |
dtolnay
left a comment
There was a problem hiding this comment.
I was about to comment the same as @SNCPlay42. I don't think any of these impls behave correctly in general. Mutations of the &mut &R by the underlying trait impls are just thrown away.
FYI @rust-lang/libs-api @jonhoo in case anyone sees a way to rescue this.
Impls for specific types like Arc<File> can work but I'm not sure which ones make sense / are needed.
|
Oh, interesting, I hadn't though of that — good catch! In that case I'd be in favor of at least adding the impls for the concrete types we know where this would be really useful (like |
If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC rust-lang#53835. CC rust-lang#94744.
Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriate If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC rust-lang#53835. CC rust-lang#94744.
Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriate If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC rust-lang#53835. CC rust-lang#94744.
If
&Timplements these traits,Arc<T>has no reason not to do soeither. This is useful for operating system handles like
FileorTcpStreamwhich don't need a mutable reference to implement thesetraits.
Fix #53835.