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

Clone is required in a bound by Copy, however Clone is marked as uncovered #193

Closed
DustinEwan opened this issue Jul 17, 2022 · 3 comments
Closed
Labels
C-question Category: A question C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream)

Comments

@DustinEwan
Copy link

As per the title, if you #[derive(Copy)] you must also #[derive(Clone)].

However Clone will be marked as uncovered in the #[derive(Clone, Copy)] statement.

image

@taiki-e
Copy link
Owner

taiki-e commented Jul 18, 2022

This is the upstream issue: see rust-lang/rust#84605 (comment) and subsequent 3 comments.

@taiki-e taiki-e closed this as completed Jul 18, 2022
@taiki-e taiki-e added the C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream) label Jul 18, 2022
@DustinEwan
Copy link
Author

@taiki-e thanks for the quick reply!

Following that link I implemented the following test that covers PartialEq, Clone, and Debug.

    #[test]
    fn ensure_derived_traits_work() {
        let foo = Foo {
            // details
        };

        assert_eq!(foo, foo.clone());

        assert!(!format!("{:?}", foo).is_empty());

        let bar = Enum::Bar;
        let baz = Enum::Bar(Bar { /* details */ });
        let qux = Enum::Qux(a, b);

        assert_eq!(bar, bar.clone());
        assert_eq!(baz, baz.clone());
        assert_eq!(qux, qux.clone());

        assert!(!format!("{:?}", bar).is_empty());
        assert!(!format!("{:?}", baz).is_empty());
        assert!(!format!("{:?}", qux).is_empty());
    }

@taiki-e taiki-e added the C-question Category: A question label Oct 2, 2022
@taiki-e
Copy link
Owner

taiki-e commented Jan 21, 2024

This will be fixed in rust-lang/rust#120185.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-question Category: A question C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream)
Projects
None yet
Development

No branches or pull requests

2 participants