Skip to content

Using mod <name> in <name>.rs leads to "internal compiler error: unexpected failure" #4338

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
mike-brown opened this issue Jan 3, 2013 · 5 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@mike-brown
Copy link

The following code snippet:

// foo.rs
mod foo;
fn main() {}

will result in the compiler throwing:

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug

with the top line of the backtrace that the error told me to run being:

rust: task b4d04940 ran out of stack

Removing the mod foo; statement fixes, and is seemingly because of the cyclic import that this causes. Is there a way that self-references using mod can be caught and handled nicely? With something like this sample it's easy to see the error and to debug, but I was chasing a typo in my mod statement for 5 minutes before I found it in my source...

@catamorphism
Copy link
Contributor

It's definitely a bug that this is handled by running out of stack! We need to have a better error message.

@nikomatsakis
Copy link
Contributor

Not critical for 0.6; removing milestone

@graydon
Copy link
Contributor

graydon commented May 22, 2013

Reproduced, real. nominating for production ready. It's a bug, but one people will hit.

@Blei
Copy link
Contributor

Blei commented Jul 9, 2013

This has been fixed.

@huonw
Copy link
Member

huonw commented Jul 9, 2013

Fixed by #7585.

@huonw huonw closed this as completed Jul 9, 2013
RalfJung added a commit to RalfJung/rust that referenced this issue May 22, 2025
FileDescription: improve read/write docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants