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

Explicit impl Clone for tx to avoid T: Clone #865

Merged
merged 1 commit into from Jan 23, 2019

Conversation

jonhoo
Copy link
Sponsor Contributor

@jonhoo jonhoo commented Jan 23, 2019

#[derive(Clone)] on a type struct Foo<T> adds an impl that requires that T: Clone:

impl<T: Clone> Clone for Foo<T>

which is unfortunate in the case of senders, because we don't want to require that the items being sent are Clone for the channel sender to be Clone. This PR adds an explicit impl Clone for the bounded and unbounded sender types which does not have the T: Clone bound.

Note that this is also an issue with #[derive(Debug)], but that one is harder to work around as chan::Tx also has #[derive(Debug)], as does chan::Chan, so we'd have to add explicit impls for all of them to make progress.

@ghost ghost deleted a comment from steviezplayyard Jan 23, 2019
@jonhoo jonhoo merged commit c6f9a06 into tokio-rs:master Jan 23, 2019
@jonhoo jonhoo deleted the clonable-senders branch January 23, 2019 20:52
jonhoo added a commit to jonhoo/tokio that referenced this pull request Jan 23, 2019
Following from tokio-rs#865, this PR
removes `#[derive(Debug)]` on `mpsc` sender and receiver types in favor
of explicit `impl fmt::Debug` blocks that don't have a `T: fmt::Debug`
bound.
jonhoo added a commit that referenced this pull request Jan 23, 2019
Following from #865, this PR
removes `#[derive(Debug)]` on `mpsc` sender and receiver types in favor
of explicit `impl fmt::Debug` blocks that don't have a `T: fmt::Debug`
bound.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant