Skip to content

Bug: use of undeclared type or module inventory #3

@SiebenCorgie

Description

@SiebenCorgie

Hi,

I tried to used the crate like this:

extern crate traitcast;
use traitcast::{TraitcastFrom, Traitcast};

pub trait Widget: TraitcastFrom{
    fn print(&self){
	println!("Yay from the trait!");
    }
}

struct One(u32);
impl One{
    fn print_one(&self){
	println!("From within one: {}", self.0);
    }
}
impl Widget for One{}


struct Two(f32);
impl Two{
    fn print_two(&self){
	println!("From within two: {}", self.0);
    }
}
impl Widget for Two{}


traitcast::traitcast!(struct One: Widget);
traitcast::traitcast!(struct Two: Widget);

However, the compiler notes for the traitcast! lines:

error[E0433]: failed to resolve: use of undeclared type or module `inventory`
   --> neith-synth/src/main.rs:100:1
    |
100 | traitcast::traitcast!(struct Two: Widget);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type or module `inventory`
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

Any idea why this might happen?
I also tried version 0.2.1, but it does not work as well.

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