Skip to content
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

Rustc hangs indefinitely when a dependent crate recursively exports one of its modules #33776

Closed
koute opened this issue May 21, 2016 · 3 comments
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically

Comments

@koute
Copy link
Member

koute commented May 21, 2016

If you do this in a lib.rs in crate a:

pub mod module;

and then you do this in a module.rs in the same crate:

pub use module;

and then you use the crate a in a crate b then rustc will hang indefinitely during the compilation.

Steps to reproduce

cargo new a
cargo new --bin b

echo 'pub mod module;' > a/src/lib.rs
echo 'pub use module;' > a/src/module.rs

echo '[dependencies.a]' >> b/Cargo.toml
echo 'path = "../a"' >> b/Cargo.toml
echo 'extern crate a;' >> b/src/main.rs
echo 'struct Instance { x: a::A }' >> b/src/main.rs

cd b
cargo build

Meta

rustc 1.10.0-nightly (179539f 2016-05-20)
host: x86_64-unknown-linux-gnu

@sfackler sfackler added the A-resolve Area: Name/path resolution done by `rustc_resolve` specifically label May 21, 2016
@jseyfried
Copy link
Contributor

cc me

@aochagavia
Copy link
Contributor

Reproduced on i686-pc-windows-gnu, with rustc 1.11.0-nightly (ab0b874 2016-06-13).

It may be interesting to see the output of cargo rustc -- -Ztime-passes:

time: 0.000; rss: 26MB  parsing
time: 0.000; rss: 26MB  configuration 1
time: 0.000; rss: 26MB  recursion limit
time: 0.000; rss: 26MB  crate injection
time: 0.000; rss: 26MB  plugin loading
time: 0.000; rss: 26MB  plugin registration
time: 0.045; rss: 55MB  expansion
time: 0.000; rss: 55MB  gated configuration checking
time: 0.000; rss: 55MB  maybe building test harness
time: 0.000; rss: 55MB  checking for inline asm in case the target doesn't support it
time: 0.000; rss: 55MB  complete gated feature checking
time: 0.000; rss: 55MB  assigning node ids
time: 0.000; rss: 55MB  collecting defs
time: 0.010; rss: 55MB  external crate/lib resolution
time: 0.000; rss: 55MB  early lint checks
time: 0.000; rss: 55MB  AST validation
^C

It seems that it goes wrong in name resolution, which is the step after AST validation.

@jseyfried
Copy link
Contributor

I fixed this in #34542.

Manishearth added a commit to Manishearth/rust that referenced this issue Jun 29, 2016
Fix non-termination on recursive module re-exports in extern crates

Fixes rust-lang#33776.
r? @nrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically
Projects
None yet
Development

No branches or pull requests

4 participants