rust/src/libsyntax/ext
bors 4db1874f4c 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
2016-07-15 08:48:41 -07:00
..
tt Start a best-effort warning cycle. 2016-07-13 04:50:35 +00:00
base.rs Instead of renaming, treat differently marked identifiers as unequal 2016-07-14 01:34:31 +00:00
build.rs Rollup merge of #34436 - jseyfried:no_block_expr, r=eddyb 2016-06-26 02:20:14 +00:00
expand.rs Auto merge of #34570 - jseyfried:no_rename, r=nrc 2016-07-15 08:48:41 -07:00
mtwt.rs Remove irrelevant tests 2016-07-14 01:34:38 +00:00
quote.rs Revert "Change fold_tt and fold_tts to take token trees by value (instead of by reference)" 2016-07-04 23:42:35 +00:00
source_util.rs Auto merge of #34424 - jseyfried:breaking_batch, r=Manishearth 2016-06-27 16:42:03 -07:00