You're assuming `use` loads code, but it only brings names into scope.
`mod submodule;` is what loads `submodule` into the crate. See
http://static.rust-lang.org/doc/master/tutorial.html#crates-and-the-module-system

On Wed, Feb 19, 2014 at 11:37 PM, benjamin adamson
<[email protected]> wrote:
> Hello, I am trying to get over a hurdle I've been stuck on for a while. I
> can't seem to figure out how to get the 'use' statements to work.
>
> I've created the smallest possible examples I could to demonstrate the
> problem I am having.
>
> The first commit shows my first attempt to 'use' a rust module. With this
> commit I am not using a mod.rs file:
> https://github.com/ShortStomp/rust-submodule-confusion-example/tree/d0e5445fbfbc01850bf8a4a523a13aff4e50c229
>
> Here is the output I get from the compiler for this basic program:
> https://gist.github.com/ShortStomp/9107140
>
> My second attempt at getting this basic example to work involves adding a
> mod.rs file inside the submodule directory.
> https://github.com/ShortStomp/rust-submodule-confusion-example/tree/5f3d3058ded8b1e29800685cba7a0438f288abe6
>
> I get the same error that I linked in the gist above. So what gives, what
> fundamental assumption am I getting wrong? The compiler is telling me to try
> adding an extern mod statement, but I don't think that is what I want. The
> files I want to use are in no way external to this package, unless that is a
> cause of my confusion?
>
> Thanks!
>
>
> _______________________________________________
> 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

Reply via email to