I have two modules (in their own files) that both try to use a third, only one of them finds the file the third is in though.
Why does the order of the mod-statements in main.rs
matter? If I remove all the "bar-stuff" then the problem still remains.
main.rs
mod foo;
mod bar;
fn main() {
foo::do_foo();
bar::do_bar();
}
foo.rs
mod foo_bar; // error will be here when "mod foo;" is first in main.rs
pub fn do_foo() {
println!("foo::");
foo_bar::do_foo_bar();
}
bar.rs
mod foo_bar; // error will move to here when putting "mod bar;" first in main.rs instead
pub fn do_bar() {
println!("bar::");
foo_bar::do_fo_bar();
}
foo_bar.rs
pub fn do_foo_bar() {
println!("foo_bar");
}