Skip to content

Supporting reexporting enumflags2::bitflags macro #48

@PPakalns

Description

@PPakalns

Macro can not find enumflags2 crate if enumflags2 is reexported (pub use).

A lot of projects use one main crate to organize all crates that all crates in workspace may use.

If enumflags2 is used with this approach following errors are raised:

error[E0432]: unresolved import `enumflags2`
   --> simulation/src/blocks.rs:584:1
    |
584 | #[enumflags2::bitflags]
    | ^^^^^^^^^^^^^^^^^^^^^^^ help: a similar path exists: `self::enumflags2`
    |
    = note: this error originates in the attribute macro `enumflags2::bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `enumflags2` in the list of imported crates
   --> simulation/src/blocks.rs:584:1
    |
584 | #[enumflags2::bitflags]
    | ^^^^^^^^^^^^^^^^^^^^^^^ could not find `enumflags2` in the list of imported crates
    |
    = note: this error originates in the attribute macro `enumflags2::bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)

Other crates try to fix this by introducing additional macro attributes that defines how to access the crate in that context.

For example strum crate requires additional attribute:

#[strum(crate = "strum")]

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions