Skip to content

Problem declaring a SET OF a SEQUENCE that contains an ENUMERATED value #296

Description

@rod-chapman

Problem trying to declare a SEQUENCE that contains an ENUMERATED field. Code as follows:

#[derive(Enumerated, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u32)]
enum EID {
e1 = 1,
e2 = 2,
e3 = 3
}

#[derive(Clone, Debug, Eq, PartialEq, Sequence, PartialOrd, Ord)]
pub struct E {
eid: EID,
b1: bool,
b2: bool,
}
impl OrdIsValueOrd for E {}

type SetOfE = SetOf<E, 2>;

Compiling says:
error[E0759]: decoder has an anonymous lifetime '_ but it needs to satisfy a 'static lifetime requirement
--> src/main.rs:83:39
|
83 | #[derive(Clone, Debug, Eq, PartialEq, Sequence, PartialOrd, Ord)]
| ^^^^^^^^
| |
| this data with an anonymous lifetime '_...
| ...is captured and required to live as long as 'static here
|
= note: this error originates in the derive macro Sequence (in Nightly builds, run with -Z macro-backtrace for more info)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions