Skip to content

Deriving error: this field does not implement Copy #35

@Voronar

Description

@Voronar

Hello.
I have the code:

enum Things { A, B, C };

enum sumtype {
  one = 0,
  two = 1
};

struct Baz {
	int x;
	int y;
	//Things things<>; // if uncomment then works
	sumtype *e;
};

Error is:

#[derive( Copy , Clone , Debug , Eq , PartialEq )] pub enum sumtype { one = 0isize , two = 1isize , }

11 | #[derive( Copy , Clone , Debug , Eq , PartialEq )] pub struct Baz { pub x : i32 , pub y : i32 , pub e : Option < Box < sumtype >> , }
   |           ^^^^                                                                                  --------------------------------- this field does not implement `Copy`

If uncomment //Things things<>; then it is ok (Copy attribute has gone from Baz):

#[derive( Copy , Clone , Debug , Eq , PartialEq )] pub enum sumtype { one = 0isize , two = 1isize , }
#[derive( Clone , Debug , Eq , PartialEq )] pub struct Baz { pub x : i32 , pub y : i32 , pub thing : Vec < Things > , pub e : Option < Box < sumtype >> , }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions