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

Avoid returning original macro if expansion fails. #12370

Merged
merged 1 commit into from
Feb 19, 2014

Conversation

rcxdude
Copy link
Contributor

@rcxdude rcxdude commented Feb 18, 2014

Closes #11692. Instead of returning the original expression, a dummy expression
(with identical span) is returned. This prevents infinite loops of failed
expansions as well as odd double error messages in certain situations.

This is a slightly better fix than #12197, because it does not produce a double error and also fixes a few other cases where an infinite loop could happen.

This does not fix the other issue in #11692 (non-builtin macros not being recognised when expanded inside macros), which I think should be moved into a separate issue.

Closes rust-lang#11692. Instead of returning the original expression, a dummy expression
(with identical span) is returned. This prevents infinite loops of failed
expansions as well as odd double error messages in certain situations.
bors added a commit that referenced this pull request Feb 19, 2014
Closes #11692. Instead of returning the original expression, a dummy expression
(with identical span) is returned. This prevents infinite loops of failed
expansions as well as odd double error messages in certain situations.

This is a slightly better fix than #12197, because it does not produce a double error and also fixes a few other cases where an infinite loop could happen.

This does not fix the other issue in #11692 (non-builtin macros not being recognised when expanded inside macros), which I think should be moved into a separate issue.
@bors bors closed this Feb 19, 2014
@bors bors merged commit 0bdfd0f into rust-lang:master Feb 19, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
…nicola

ide: insert whitespaces surrounding `_` in macro expansion

#### Before

```rust
for_in 0..10 {
  foo();
}
```

#### After

```rust
for _ in 0..10 {
  foo();
}
```
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.

Infinite loop when compiling nested macros
3 participants