capnproto / capnpc-rust

Cap'n Proto code generation for Rust
76 stars 26 forks source link

Use PhantomData everywhere necessary to compile with latest Rust #6

Closed kemurphy closed 9 years ago

kemurphy commented 9 years ago

Some of the enums needed marker variants for the unused lifetimes. Actually, on second thought, maybe a better approach would be a wrapper struct with the marker and a lifetimeless enum:

struct Which<'a,A0,A1,A2,A3,A4> {
    marker: ::std::marker::PhantomData<&'a ()>,
    pub kind: Kind<A0,A1,A2,A3,A4>,
}

What are your thoughts?

kemurphy commented 9 years ago

Also looks like the generated code needs to be adjusted.

dwrensha commented 9 years ago

Thanks! I found a better fix: 'a doesn't need to be a direct parameter of Which at all.

kemurphy commented 9 years ago

Even better. Thanks!