-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Compiler infinite loop with memory allocation #38585
Comments
Getting this exact behavior very often now with types that don't exist in scope. |
It might not be related, but rustdoc is hanging even when rustc successfully compiles. It has the exact same memory and CPU behavior, but I can't get a good stack trace. EDIT: After about 6GB of memory usage by rustdoc, it's stack overflowed. So this is most definitely a recursion issue. Visual Studio was unable to give an exact function name where the overflow occurred, unfortunately. |
Another note: All this memory is either empty or very, very redundant. Although it has allocated over 16GB now, Windows 10 memory compression is keeping it around 6GB actual RAM usage. EDIT: 4.5GB actual usage after a periodic recompression by the OS. I'm kind of impressed. |
I'm trying to reproduce this, so a few questions:
|
Ah, I think I see. in The only reason I could use the types defined in those modules, is because in each I'm renaming the files and modules and trying everything again. |
Nope, that didn't fix it. Problem exists on stable, too. If anything, it's allocating memory leaks even faster than the nightly. EDIT: Even rustdoc hanging when rustc succeeds still exists on stable. I should note I've been testing this by intentionally switching some |
Repos are here: Of course it's all still very WIP, so apologies in advance. I'm not sure if it even works correctly outside of MSVC yet. |
I figured out how to create a minimal test case: https://github.com/novacrazy/rust-test-case-38585 |
Okay, nevermind the test case. I know exactly what the issue is. pub mod myMod {
pub use super::*;
} Is recursive. EDIT: But it only causes issues from other crates, as far as I can tell so far. So if crate A does the above, using |
Awesome work @novacrazy! cc @jseyfried, this is your are of expertise, I think. This is a (minor) regression from 1.7.0 to 1.8.0. |
Some questions:
Things to note just in case they overlooked it in my ramblings:
|
@novacrazy Thanks for the report! This is #34324, fixed in #38539 (just merged).
Recursive imports should "just work". Let me know if you have further questions about how we should handle them in the language or in the compiler.
Yes, this is due to the recent stabilization of RFC 1560 (specifically this rule and this rule).
Interesting, this might be is a separate issue in |
EDIT:
This issue is with recursively imported modules like this:
where if crate A defines a module like that, attempting to use it in crate B will cause rustc and rustdoc to choke.
I'm sorry I can't provide any compiler output for this, because it technically did not crash, but I did get the thread stack using Process Explorer.
Here is the process info when I decided to kill the process:

And here is the stack trace where it seems to copy new memory:

rustc_resolve
seems to crop up often as I refreshed the stack view.I can't reproduce this with a short piece of code, because the resolution stuff is tied into the project, but I can show you exactly what happened in my code to produce this effect.
Basically, I'm writing an OpenAL wrapper, and attempting to refer to
GLuint
rather thanALuint
causes the bug.For example:
should give an error that
GLuint
is not found, because it was a typo on my part, but instead it seems to soft-fail exhaustively resolvingGLuint
If I correct my typo to
ALuint
, it compiles instantly with minimal memory usage.Meta
Version:
The text was updated successfully, but these errors were encountered: