Skip to content

Add missing generic in "perfect derive" paragraph #1041

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

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

kupiakos
Copy link
Contributor

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9662ba9557d61e0507477e386a81e260

use std::rc::Rc;

struct T(u32);

// This does compile:
// #[derive(Clone)]
// struct MyStruct(Rc<T>);

// This does not compile, needing perfect derives:
#[derive(Clone)]
struct MyStruct<T>(Rc<T>);

fn main() {
    let x = Rc::new(T(10));
    MyStruct(x).clone();
}

Copy link
Member

@rylev rylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@rylev rylev merged commit d174cb6 into rust-lang:master Oct 24, 2022
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.

2 participants