Skip to content

libsyntax: fix infinite loop when recursively including modules #7585

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

Merged
merged 1 commit into from
Jul 7, 2013
Merged

libsyntax: fix infinite loop when recursively including modules #7585

merged 1 commit into from
Jul 7, 2013

Conversation

Blei
Copy link
Contributor

@Blei Blei commented Jul 4, 2013

Fixes #7276

match maybe_i {
Some(i) => {
let mut err = ~"circular modules: ";
for uint::range(i, self.sess.included_mod_stack.len()) |i| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be

let stack = &self.sess.included_mod_stack;
for stack.slice(i, stack.len()).iter().advance |m| {
    err.push_str(fmt!("%? -> ", m.to_str()));
}

? (Possibly even moving the stack binding out of the match to use it there.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, rebased patch is coming up.

Unfortunately I couldn't move the let stack = .. out of the match due to dynamic borrow checker errors. 😡

@Blei
Copy link
Contributor Author

Blei commented Jul 4, 2013

@huonw Thanks for the feedback, new version has been pushed.

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 this pull request may close these issues.

Circular mod refs causes rustc to loop eternally
3 participants