resolve issue with reexports #5693

doy opened this Issue Apr 3, 2013 · 4 comments


None yet
4 participants

doy commented Apr 3, 2013

#[link(name = "foo", vers = "0")];
#[crate_type = "lib"];

pub use bar::MyValue;

mod bar;
pub mod baz;
pub enum MyType { MyValue }

pub fn blorg (_: MyType) { }
mod bar;
pub fn quux (m: bar::MyType) { bar::blorg(m) }
extern mod foo;

fn main () {
$ rustc
$ rustc -L. 4:31 error: mismatched types: expected `foo::baz::bar::MyType` but found `foo::bar::MyType` (expected enum foo::baz::bar::MyType but found enum foo::bar::MyType)     foo::baz::quux(foo::MyValue);
error: aborting due to previous error

As far as I can tell, foo::baz::bar::MyType is nonsense here.


alexcrichton commented Apr 20, 2013

Whoops just realized the reference from that pull request was a typo, disregard that...


msullivan commented Jun 13, 2013

What is going on here is that is getting compiled twice, once for each time it is referenced with "mod bar;". Is this as intended?


msullivan commented Jun 13, 2013

OK, I think this is working as intended.

@msullivan msullivan closed this Jun 13, 2013


graydon commented Jun 13, 2013

Yes, this is doing what it was supposed to do. The bar module is being compiled at two different locations in the local module tree. There is no restriction on doing this (indeed, there are a few weird cases where you want to do it, such as we used to do with the int template module).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment