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

#[derive(Clone)] always require generic arguments to be Clone, which is too restrictive #32673

Closed
VFLashM opened this issue Apr 2, 2016 · 2 comments

Comments

@VFLashM
Copy link
Contributor

VFLashM commented Apr 2, 2016

[derive(Clone)] should not require generic arguments to be Clone if it's not necessary.

use std::rc::Rc;

struct S;

#[derive(Clone)]
struct Works(Rc<S>);

#[derive(Clone)]
struct Fails<T>(Rc<T>);

fn main() {
    let w = Works(Rc::new(S));
    w.clone(); // ok

    let f = Fails(Rc::new(S));
    f.clone(); // fails
}
@Stebalien
Copy link
Contributor

Duplicate of #26925

@bluss
Copy link
Member

bluss commented Apr 2, 2016

Thank you @VFLashM; closing as a dup.

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

3 participants