about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2016-09-28Rollup merge of #36789 - jseyfried:non_inline_mod_in_block, r=nikomatsakisJonathan Turner-9/+16
Allow more non-inline modules in blocks Currently, non-inline modules without a `#[path]` attribute are not allowed in blocks. This PR allows non-inline modules that have an ancestor module with a `#[path]` attribute, provided there is not a nearer ancestor block. For example, ```rust fn main() { #[path = "..."] mod foo { mod bar; //< allowed by this PR fn f() { mod bar; //< still an error } } } ``` Fixes #36772. r? @nikomatsakis
2016-09-28Allow non-inline modules in more places.Jeffrey Seyfried-9/+16
2016-09-27Auto merge of #36601 - jseyfried:build_reduced_graph_in_expansion, r=nrcbors-3/+16
Assign def ids and build the module graph during expansion r? @nrc
2016-09-27With `--test`, make `#[test]` functions `pub` in `InvocationCollector`Jeffrey Seyfried-2/+11
and expand the `__test_reexports` in the correct scope.
2016-09-27Avoid aborting after expansion from `BuildReducedGraphVisitor` errors.Jeffrey Seyfried-1/+5
2016-09-26Auto merge of #36764 - jonathandturner:rollup, r=jonathandturnerbors-270/+141
Rollup of 14 pull requests - Successful merges: #36563, #36574, #36586, #36662, #36663, #36669, #36676, #36721, #36723, #36727, #36729, #36742, #36754, #36756 - Failed merges:
2016-09-26Rollup merge of #36721 - TimNN:infinite-emptiness, r=nrcJonathan Turner-1/+38
reject macros with empty repetitions Fixes #5067 by checking the lhs of `macro_rules!` for repetitions which could match an empty token tree.
2016-09-26Move `ensure_complete_parse` into `expand.rs`.Jeffrey Seyfried-0/+12
2016-09-26make emit_feature_err take a ParseSessTim Neumann-1/+1
2016-09-26reject macros with empty repetitionsTim Neumann-1/+38
2016-09-26Refactor `ensure_complete_parse`.Jeffrey Seyfried-36/+19
2016-09-26Remove `TokResult`.Jeffrey Seyfried-161/+29
2016-09-26Refactor `parse_expansion` out of `ResultAnyMacro`.Jeffrey Seyfried-92/+63
2016-09-24Load macros from `#[macro_use]` extern crates in `resolve`.Jeffrey Seyfried-69/+13
2016-09-24Refactor `ext::tt::macro_rules::compile` to take a `ParseSess` instead of an ↵Jeffrey Seyfried-40/+33
`ExtCtxt`.
2016-09-23Add attribute support to generic lifetime and type parameters.Felix S. Klock II-0/+6
I am using `ThinAttributes` rather than a vector for attributes attached to generics, since I expect almost all lifetime and types parameters to not carry any attributes.
2016-09-22Auto merge of #36573 - jseyfried:groundwork, r=nrcbors-10/+13
resolve: groundwork for building the module graph during expansion r? @nrc
2016-09-22Auto merge of #36154 - nrc:proc-macro-init, r=@jseyfriedbors-19/+306
Adds a `ProcMacro` form of syntax extension This commit adds syntax extension forms matching the types for procedural macros 2.0 (RFC #1566), these still require the usual syntax extension boiler plate, but this is a first step towards proper implementation and should be useful for macros 1.1 stuff too. Supports both attribute-like and function-like macros. Note that RFC #1566 has not been accepted yet, but I think there is consensus that we want to head in vaguely that direction and so this PR will be useful in any case. It is also fairly easy to undo and does not break any existing programs. This is related to #35957 in that I hope it can be used in the implementation of macros 1.1, however, there is no direct overlap and is more of a complement than a competing proposal. There is still a fair bit of work to do before the two can be combined. r? @jseyfried cc @alexcrichton, @cgswords, @eddyb, @aturon
2016-09-22Use `Resolver::visit_expansion` only with monotonic expansions.Jeffrey Seyfried-10/+13
2016-09-23reviewer comments and rebasingNick Cameron-98/+147
2016-09-22Auto merge of #36618 - jseyfried:crate_root_attr_invoc, r=nrcbors-7/+14
macros: allow attribute invocations at the crate root Fixes #36617. r? @nrc
2016-09-22Adds a `ProcMacro` form of syntax extensionNick Cameron-12/+250
This commit adds syntax extension forms matching the types for procedural macros 2.0 (RFC #1566), these still require the usual syntax extension boiler plate, but this is a first step towards proper implementation and should be useful for macros 1.1 stuff too. Supports both attribute-like and function-like macros.
2016-09-21Allow attribute macro invocations at the crate root.Jeffrey Seyfried-7/+14
2016-09-20rustc_metadata: go only through rustc_serialize in astencode.Eduard Burtescu-3/+3
2016-09-17Make the return type of AstBuilder.stmt_let_typed match the return type of ↵CensoredUsername-4/+4
other AstBuilder.stmt* functions
2016-09-15Remove `MacroRulesTT`.Jeffrey Seyfried-50/+47
2016-09-15Allow `IdentMacroExpander::expand` to access the ident macro invocation's ↵Jeffrey Seyfried-3/+5
attributes.
2016-09-15Move fields `single_step` and `keep_macs` from `MacroExpander` to ↵Jeffrey Seyfried-10/+7
`ExpansionConfig`.
2016-09-15Rollup merge of #36438 - jseyfried:node_ids_in_expansion, r=nrcManish Goregaokar-486/+282
Assign node ids during macro expansion After this PR, - The `ExtCtxt` can access `resolve`'s `Resolver` through the trait object `ext::base::Resolver`. - The `Resolver` trait object can load macros and replaces today's `MacroLoader` trait object. - The macro expander uses the `Resolver` trait object to resolve macro invocations. - The macro expander assigns node ids and builds the `Resolver`'s `macros_at_scope` map. - This is groundwork for merging import resolution and expansion. - Performance of expansion together with node id assignment improves by ~5%. **EDIT:** Since Github is reordering the commits, here is `git log`: - b54e1e399741579612f13e2df98a25ea9447989d: Differentiate between monotonic and non-monotonic expansion and only assign node ids during monotonic expansion. - 78c00398780db6f59ebf43e765fa9368dad436d2: Expand generated test harnesses and macro registries. - f3c2dca3539e6edc745f9c91898cb97d281865c1: Remove scope placeholders from the crate root. - c86c8d41a26b2037e80c9fd028a59313a78b3a66: Perform node id assignment and `macros_at_scope` construction during the `InvocationCollector` and `PlaceholderExpander` folds. - 72a636975fc5d0bb4af45af7bdd97987cc722a6a: Move macro resolution into `librustc_resolve`. - 20b43b23230ce063ccf99a4841d85790ad311bdf: Rewrite the unit tests in `ext/expand.rs` as a `compile-fail` test. - a9821e1658240bb2c056f260a4b6bc9789301fae: Refactor `ExtCtxt` to use a `Resolver` instead of a `MacroLoader`. - 60440b226d2f70bdae803443ff7ad2e2af2c9b10: Refactor `noop_fold_stmt_kind` out of `noop_fold_stmt`. - 50f94f6c95c944f08c4af264f48260e42efefd47: Avoid needless reexpansions. r? @nrc
2016-09-13Differentiate between monotonic and non-monotonic expansion andJeffrey Seyfried-13/+29
only assign node ids during monotonic expansion.
2016-09-13Remove scope placeholders from the crate root.Jeffrey Seyfried-2/+13
2016-09-13Perform node id assignment and `macros_at_scope` construction duringJeffrey Seyfried-9/+79
the `InvocationCollector` and `PlaceholderExpander` folds.
2016-09-13Move macro resolution into `librustc_resolve`.Jeffrey Seyfried-349/+150
2016-09-13Rewrite the unit tests in `ext/expand.rs` as a `compile-fail` test.Jeffrey Seyfried-107/+0
2016-09-13Refactor `ExtCtxt` to use a `Resolver` instead of a `MacroLoader`.Jeffrey Seyfried-12/+12
2016-09-13Avoid needless reexpansions.Jeffrey Seyfried-5/+10
2016-09-10Improve `Eq` derivingVadim Petrochenkov-0/+18
2016-09-07Improve `directory` computation during invocation collection.Jeffrey Seyfried-5/+9
2016-09-07Implement stackless placeholder expansion.Jeffrey Seyfried-8/+22
2016-09-07Strip unconfigured nodes in the `InvocationCollector` fold.Jeffrey Seyfried-13/+60
2016-09-05Load macros from `extern crate`s in the `InvocationCollector` fold.Jeffrey Seyfried-62/+22
2016-09-05Implement stackless expansion.Jeffrey Seyfried-173/+189
2016-09-05Add module `ext::placeholders` with `placeholder()` and `PlaceholderExpander`.Jeffrey Seyfried-39/+181
2016-09-05Refactor `expand_invoc(.., fld)` -> `self.expand_invoc(..)`.Jeffrey Seyfried-207/+212
2016-09-05Refactor `SyntaxEnv`.Jeffrey Seyfried-126/+119
2016-09-05Refactor `expand_*` into `expander.fold_*`.Jeffrey Seyfried-214/+194
2016-09-05Clean up module processing.Jeffrey Seyfried-34/+20
2016-09-05Refactor out `expand_item` (with better semantics than before).Jeffrey Seyfried-36/+39
2016-09-05Refactor away `expand_item`.Jeffrey Seyfried-7/+3
2016-09-05Generalize `Invocation` to include modifiers/decorators.Jeffrey Seyfried-95/+138