Description
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.