Skip to content

Conflicting implementations for two similarly named types #162

@swthorn

Description

@swthorn

Hi,

I am using this ASN.1 file:

Test DEFINITIONS AUTOMATIC TAGS ::=

BEGIN

EUTRANTraceID ::= OCTET STRING (SIZE (8))
E-UTRAN-Trace-ID ::= OCTET STRING (SIZE (8))

END

This generates the following (invalid) code after running the rasn compiler:

pub mod test {
    extern crate alloc;
    use core::borrow::Borrow;
    use rasn::prelude::*;
    use std::sync::LazyLock;
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(delegate, identifier = "E-UTRAN-Trace-ID")]
    pub struct EUTRANTraceID(pub FixedOctetString<8usize>);
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(delegate)]
    pub struct EUTRANTraceID(pub FixedOctetString<8usize>);
}

the struct EUTranTraceID is defined twice.

Obviously, these names are very similar and "-" characters are not valid for rust structure definitions. So the rasn compiler removes the - characters before defining the struct. However, it may create a conflict with another type when doing this.

I don't have a great fix for this. Maybe if a duplicate type exists, you can add a number to the end?

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