Skip to content

Duplicate module warning error #2359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jesse99 opened this issue May 6, 2012 · 3 comments
Closed

Duplicate module warning error #2359

jesse99 opened this issue May 6, 2012 · 3 comments

Comments

@jesse99
Copy link
Contributor

jesse99 commented May 6, 2012

I don't have a repro for this, but it's a really annoying error because it seems to be a lie and it's not at all clear how users can fix it. I had a library depending on three other libraries. The external libraries were copied into a local project/bin directory so that I had more control over them.

This was all working fine until I decided to rename my project. As part of this process I removed my bin directory and copied new versions of the external libraries into bin. Now when I do rustc --out-dir bin -L bin -O src/rwebserve.rc I get:

src/rwebserve.rc:11:0: 11:42 error: duplicate definition of module socket
src/rwebserve.rc:11 use socket (name = "socket", vers = "0.1");

If I change the use statement to "use socketXXX" I get the same error which makes me think that it is not a duplicate definition (and I don't see how it would be). My guess is that this is caused when using libraries built by slightly different versions of rustc. Unfortunately I now get an ICE trying to build one of the libraries so I can't try it out atm (currently building a new rustc in the hopes that that will fix the ICE).

@jesse99
Copy link
Contributor Author

jesse99 commented May 6, 2012

Finally fixed this. I thought that if you had a foo.rc file you could have a foo.rs which would automatically get compiled in and allow you to put the foo.rs items in the project namespace. When I did my renaming I changed things around to use that pattern, but that seemed to be the cause of my duplicate module error.

After renaming rwebserve.rs to server.rs and adding mod sever; to my rc file I can now build again.

@pcwalton
Copy link
Contributor

pcwalton commented May 6, 2012

Closing this.

@pcwalton pcwalton closed this as completed May 6, 2012
@jesse99
Copy link
Contributor Author

jesse99 commented May 6, 2012

I don't think that this should be closed:

  1. Using an rs file with the same name as the rc file does work, at least in simple cases.
  2. Given that why didn't my case work? A quick perusal of the ref manual and the tutorial wasn't helpful.
  3. If my case is expected not to work a better error message than "duplicate modue" would be really really helpful.

bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
set up triagebot

`@Mark-Simulacrum` does this look like a sensible configuration?
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
tshepang pushed a commit to tshepang/rust that referenced this issue May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants