I'm trying to call a function from a module located in a separate file, the function is public and I am calling it using a full path, but rustc still complains about "unresolved name".
a.rs
pub mod b;
fn main() {
b::f()
}
b.rs
pub mod b {
pub fn f(){
println!("Hello World!");
}
}
compilation
$ rustc a.rs
a.rs:3:5: 3:9 error: unresolved name `b::f`.
When I move the module to the crate's main file, everything works fine.
one_file.rs
pub mod b {
pub fn f(){
println!("Hello World!");
}
}
fn main() {
b::f()
}
Aren't these two ways supposed to be equivalent? Am I doing something wrong, or it's a bug in rustc?