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

Auto-derived Clone for something using RcPointer is unusable #1

Closed
orium opened this issue Feb 22, 2019 · 0 comments
Closed

Auto-derived Clone for something using RcPointer is unusable #1

orium opened this issue Feb 22, 2019 · 0 comments

Comments

@orium
Copy link
Owner

orium commented Feb 22, 2019

Issue created for future reference.

This is a rustc issue in the way Clone is derived.

The problem is that

#[derive(Clone)] 
struct AThing<T, C: RcPointerKind> {
    field: RcPointer<C, T>,
}

expands to

impl<T: Clone, C: Clone + RcPointerKind> Clone for AThing<T, C> { ... }

which requires C to implement Clone. In practice it should only require the type of AThing::field to be implement Clone. See rust-lang/rust#26925 (comment) for details.

@orium orium closed this as completed Feb 22, 2019
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

No branches or pull requests

1 participant