Skip to content

The name __initXXXXXXX is defined multiple times #8

@stijnh

Description

@stijnh

I have a usecase where the same object is submitted multiple times to inventory. See the following minimal example (my actual application is more complex and the duplicates are the results of several macro expansion).

struct Foo(i32);
inventory::collect!(Foo);
inventory::submit!(Foo(123));
inventory::submit!(Foo(123));

This gives the following error:

error[E0428]: the name `__init6561350217902411997` is defined multiple times
  --> src/main.rs:3:1
   |
 3 | inventory::submit!(Foo(123));
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `__init6561350217902411997` redefined here
 4 | inventory::submit!(Foo(123));
   | ----------------------------- previous definition of the value `__init6561350217902411997` here
   |
   = note: `__init6561350217902411997` must be defined only once in the value namespace of this module
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

Is this fundamental limitation of using ctor's or is there some work-around available? Thanks for the awesome crate and your work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions