Skip to content

der_derive: add support for reference newtypes #2039

@tarcieri

Description

@tarcieri

#1998 changed the type signature of OctetStringRef from:

pub struct OctetStringRef<'a>

to:

pub struct OctetStringRef

where the type is now used as &'a OctetStringRef.

However to simplify the change, der_derive did not receive a proper corresponding update, but rather now uses an type alias to preserve the old shape:

https://github.com/RustCrypto/formats/blob/f7905f1/der/src/asn1/octet_string.rs#L13

pub type OctetStringRefDeriveHack<'a> = &'a OctetStringRef;

...which is now used in the custom derive here:

https://github.com/RustCrypto/formats/blob/f7905f1/der_derive/src/asn1_type.rs#L97

Asn1Type::OctetString => quote!(::der::asn1::OctetStringRefDeriveHack),

For a proper fix, der_derive needs to be updated to have first-class support for referring to such types via a &'a MyRef lifetime instead of a MyRef<'a> lifetime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions