-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Read
, Write
and Seek
impls for Arc<T>
where appropriate
#94744
Conversation
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
&T
implements these traits,Arc<T>
has no reason not to do soeither. This is useful for operating system handles like
File
orTcpStream
which don't need a mutable reference to implement thesetraits.
Fix #53835.