You should be careful to declare modules only once. It looks like you have two instances of "mod actions" in the module hierarchy, and both modules will be compiled as separate entities (although everything will have the same name).
If you remove the `mod actions` inside of testaction.rs you should start making some more progress. You'll probably hit some name resolution issues, but just be sure to import the previous declaration of the `actions` module in the top level of the crate. On Thu, Nov 7, 2013 at 11:50 PM, Philippe Delrieu <[email protected]> wrote: > Hello, rust addict. > > I have a problem with rustc. I have 3 files. > The first one actions.rs contains a trait declaration : > > pub trait Action { > // process the action on server side. > fn process(&self) -> ~str; > } > > The second contains a trait implementation testaction.rs: > mod actions; > > > pub struct TestAction { > actiontype: uint > } > > impl actions::Action for TestAction { > > fn process(&self) -> ~str { > ~"" > } > } > The third test the trait cast : > mod actions; > mod midi; > > let element : ~testaction::TestAction = > ~testaction::TestAction{actiontype:1}; > let actelm: ~actions::Action = element as ~actions::Action; > //error here > println("process element :" + actelm.process()); > => generate error: failed to find an implementation of trait > > let actelm: ~testaction::actions::Action = element as > ~testaction::actions::Action; //error here > println("process element :" + actelm.process()); > => generate error: trait `Action` is inaccessible > > If I put testaction content in the test file rustc compile. > > Any idea? > > Philippe Delrieu > > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
