Skip to content
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

Some implementations of Write should implement Write for an immutable reference as well #73836

Closed
nagisa opened this issue Jun 28, 2020 · 0 comments · Fixed by #76275
Closed
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@nagisa
Copy link
Member

nagisa commented Jun 28, 2020

The implementations of Write which are MT-safe under the covers can implement a trait along the lines of

impl Write for &'_ Self { ... }

and some already do:

impl<'a> Write for &'a UnixStream { ... }
impl<'_> Write for &'_ TcpStream { ... }
impl<'_> Write for &'_ File { ... }

However, these appear to be the extent of the current implementations. The following types could also do the same:

  • Sink – does not inspect data and Write methods are a no-op;
  • Stdin/Stdout – internally a Mutex (and even if the Mutex was removed in the future, the underlying syscalls are MT-safe – much like they are for a regular File);
  • ChildStdin – similar to File or *Streams;
@nagisa nagisa added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Jun 28, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Sep 22, 2020
…73836, r=dtolnay

Implementation of Write for some immutable ref structs

Fixes  rust-lang#73836
ecstatic-morse added a commit to ecstatic-morse/rust that referenced this issue Sep 22, 2020
…73836, r=dtolnay

Implementation of Write for some immutable ref structs

Fixes  rust-lang#73836
ecstatic-morse added a commit to ecstatic-morse/rust that referenced this issue Sep 22, 2020
…73836, r=dtolnay

Implementation of Write for some immutable ref structs

Fixes  rust-lang#73836
@bors bors closed this as completed in 28db521 Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant