Skip to content

Rust: inconsistent union has value and type the wrong way round #9001

@mwilliamson

Description

@mwilliamson

Hello!

It's entirely possible I may have misunderstood something, but when creating an inconsistent union error in the rust verifier, it looks like the names of the type and value fields are the wrong way round. In the verifier, they are passed in the order type, then value:

return InvalidFlatbuffer::new_inconsistent_union(
format!("{}_type", field.name()),
field.name().to_string(),
)?;

But the new_inconsistent_union function expects them in the order value, then type:

pub fn new_inconsistent_union<T>(
field: impl Into<Cow<'static, str>>,
field_type: impl Into<Cow<'static, str>>,
) -> Result<T> {

Which then leads to errors that are slightly confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions