Skip to content

Circular mod refs causes rustc to loop eternally #7276

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
m10e opened this issue Jun 21, 2013 · 0 comments · Fixed by #7585
Closed

Circular mod refs causes rustc to loop eternally #7276

m10e opened this issue Jun 21, 2013 · 0 comments · Fixed by #7585

Comments

@m10e
Copy link

m10e commented Jun 21, 2013

Circular mod refs causes rustc to loop eternally, consuming lots of CPU and endlessly allocating more memory. Take "eternally" with a grain of salt as I couldn't keep it running very long since it was paging out everything else in RAM and sending the computer to a virtual stop.

It may or may not be related to issue #3352, although that issue mentions a poor error message and not en eternal loop, so perhaps it merits opening a new issue. I also noticed #6143 referencing several other module-related issues (e.g. #3352) where this one might fit in.

I'm using the master branch, commit b0e3ffd on OSX 10.8.3. I discussed the issue briefly with @cmr on IRC before creating the issue.

Steps to reproduce:

Contents of main.rs:

#[link(name = "modtest", vers = "0.0.1", author = "whoever")];
#[crate_type = "bin"];
#[warn(non_camel_case_types)];

use hello::*;
mod hello;

pub fn hi_str() -> ~str {
  ~"Hi!"
}

fn main() {
  say_hello();
}

Contents of hello.rs:

mod main;

pub fn say_hello() {
  io::println(main::hi_str());
}

And then just: rustc main.rs

Expected result:
I'm not sure if this is allowed or not as I'm trying to understand what's possible with the module system, but it probably shouldn't loop eternally.

Actual result:
Eternal loop, never stops allocating memory.

@bors bors closed this as completed in 3c5cfdf Jul 7, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 1, 2021
Add import_rename lint, this adds a field on the Conf struct

fixes rust-lang#7276

changelog: Add ``[`import_rename`]`` a lint that enforces import renaming defined in the config file.
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

Successfully merging a pull request may close this issue.

1 participant