Created
October 14, 2014 15:08
-
-
Save Fiona-J-W/0840b55e6925b7d36f66 to your computer and use it in GitHub Desktop.
Nonworking Rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod tu1; | |
fn main() { | |
println!("Hello World"); | |
tu1::fun1(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod tu2; | |
pub fn fun1() { | |
println!("fun1()"); | |
::tu2::fun2(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn fun2() { | |
println!("fun2()"); | |
} |
Looks like Rust is trying to enforce a certain directory structure to your modules. Does http://thread.gmane.org/gmane.comp.lang.rust.devel/10032 help?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ rustc mod.rs
tu1.rs:2:5: 2:8 error: cannot declare a new module at this location
tu1.rs:2 mod tu2;
^~~
tu1.rs:2:5: 2:8 note: maybe move this module
tu1
to its own directory viatu1/mod.rs
tu1.rs:2 mod tu2;
^~~
tu1.rs:2:5: 2:8 note: ... or maybe
use
the moduletu2
instead of possibly redeclaring ittu1.rs:2 mod tu2;
^~~