about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-07-15 08:48:41 -0700
committerGitHub <noreply@github.com>2016-07-15 08:48:41 -0700
commit4db1874f4c26a2c88acb5e46b413e9c4adce3477 (patch)
treefc2f8bc9199b543239eeb39d531895e500e74542 /src/libstd/sys/unix/stack_overflow.rs
parent3cc3ad11e6fadcba443cc50ba6ed03ab04d34355 (diff)
parentc1a6ff2d6b1dccd5af1c6cb9b9e67066af4c0247 (diff)
downloadrust-4db1874f4c26a2c88acb5e46b413e9c4adce3477.tar.gz
rust-4db1874f4c26a2c88acb5e46b413e9c4adce3477.zip
Auto merge of #34570 - jseyfried:no_rename, r=nrc
Simplify the macro hygiene algorithm

This PR removes renaming from the hygiene algorithm and treats differently marked identifiers as unequal.

This change makes the scope of identifiers in `macro_rules!` items empty. That is, identifiers in `macro_rules!` definitions do not inherit any semantics from the `macro_rules!`'s scope.

Since `macro_rules!` macros are items, the scope of their identifiers "should" be the same as that of other items; in particular, the scope should contain only items. Since all items are unhygienic today, this would mean the scope should be empty.

However, the scope of an identifier in a `macro_rules!` statement today is the scope that the identifier would have if it replaced the `macro_rules!` (excluding anything unhygienic, i.e. locals only).

To continue to support this, this PR tracks the scope of each `macro_rules!` and uses it in `resolve` to ensure that an identifier expanded from a `macro_rules!` gets a chance to resolve to the locals in the `macro_rules!`'s scope.

This PR is a pure refactoring. After this PR,
 - `syntax::ext::expand` is much simpler.
 - We can expand macros in any order without causing problems for hygiene (needed for macro modularization).
 - We can deprecate or remove today's `macro_rules!` scope easily.
 - Expansion performance improves by 25%, post-expansion memory usage decreases by ~5%.
 - Expanding a block is no longer quadratic in the number of `let` statements (fixes #10607).

r? @nrc
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions