Skip to content

Macros are unhygenic #51

@rdrpenguin04

Description

@rdrpenguin04

When using this alongside the xlang_abi crate, the following error is thrown:

error[E0053]: method `from_u64` has an incompatible type for trait
  --> modules/elf/src/lib.rs:13:10
   |
13 | #[derive(FromPrimitive, ToPrimitive)]
   |          ^^^^^^^^^^^^^
   |          |
   |          expected enum `std::option::Option`, found enum `xlang_abi::option::Option`
   |          help: change the output type to match the trait: `std::option::Option<ProgramHeaderType>`
   |
   = note: expected fn pointer `fn(_) -> std::option::Option<ProgramHeaderType>`
              found fn pointer `fn(_) -> xlang_abi::option::Option<ProgramHeaderType>`
   = note: this error originates in the derive macro `FromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)

This can be solved by specifying core::option::Option in any place where Option is used.

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