about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
AgeCommit message (Collapse)AuthorLines
2016-07-14Remove irrelevant testsJeffrey Seyfried-130/+1
2016-07-14Implement `macro_rules!` placeholders and the macro scope mapJeffrey Seyfried-6/+27
2016-07-14Instead of renaming, treat differently marked identifiers as unequalJeffrey Seyfried-423/+7
2016-07-12Clean up statement parsing without changing the semantics of `parse_stmt`.Jeffrey Seyfried-8/+1
2016-07-06Auto merge of #34652 - jseyfried:fix_expansion_perf, r=nrcbors-4/+4
Fix expansion performance regression **syntax-[breaking-change] cc #31645** This fixes #34630 by reverting commit 5bf7970 of PR #33943, which landed in #34424. By removing the `Rc<_>` wrapping around `Delimited` and `SequenceRepetition` in `TokenTree`, 5bf7970 made cloning `TokenTree`s more expensive. While this had no measurable performance impact on the compiler's crates, it caused an order of magnitude performance regression on some macro-heavy code in the wild. I believe this is due to clones of `TokenTree`s in `macro_parser.rs` and/or `macro_rules.rs`. r? @nrc
2016-07-05Strip unconfigured items from `MultiModifier`-expanded ASTJeffrey Seyfried-1/+5
2016-07-04Revert "Change `fold_tt` and `fold_tts` to take token trees by value ↵Jeffrey Seyfried-4/+4
(instead of by reference)" This reverts commit 5bf7970ac70b4e7781e7b2f3816720aa62fac6fd.
2016-06-29Rollup merge of #34495 - jseyfried:only_ident_macro_invocations, r=eddybManish Goregaokar-1/+1
Forbid type parameters and global paths in macro invocations Fixes #28558. This is a [breaking-change]. For example, the following would break: ```rust macro_rules! m { () => { () } } fn main() { m::<T>!(); // Type parameters are no longer allowed in macro invocations ::m!(); // Global paths are no longer allowed in macro invocations } ``` Any breakage can be fixed by removing the type parameters or the leading `::` (respectively). r? @eddyb
2016-06-29Rollup merge of #34459 - jseyfried:expansion_cleanup, r=nrcManish Goregaokar-19/+13
Miscellaneous macro expansion cleanup and groundwork r? @nrc
2016-06-29Treat `MultiDecorator`s as a special case of `MultiModifier`sJeffrey Seyfried-78/+33
2016-06-28cleanup: use `DummyResult` to implement `MacroGenerable::dummy`Jeffrey Seyfried-19/+13
2016-06-27Forbid type parameters and global paths in macro invocationsJeffrey Seyfried-1/+1
2016-06-26Rollup merge of #34436 - jseyfried:no_block_expr, r=eddybJeffrey Seyfried-10/+1
To allow these braced macro invocation, this PR removes the optional expression from `ast::Block` and instead uses a `StmtKind::Expr` at the end of the statement list. Currently, braced macro invocations in blocks can expand into statements (and items) except when they are last in a block, in which case they can only expand into expressions. For example, ```rust macro_rules! make_stmt { () => { let x = 0; } } fn f() { make_stmt! {} //< This is OK... let x = 0; //< ... unless this line is commented out. } ``` Fixes #34418.
2016-06-26Rollup merge of #34339 - jseyfried:thin_vec, r=petrochenkov,ManishearthJeffrey Seyfried-4/+4
Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`.
2016-06-26Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddybJeffrey Seyfried-72/+52
Refactor away `ast::Decl`, refactor `ast::Stmt`, and rename `ast::ExprKind::Again` to `ast::ExprKind::Continue`.
2016-06-26Rollup merge of #33943 - jseyfried:libsyntax_cleanup, r=nrcJeffrey Seyfried-39/+29
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-26Rollup merge of #34385 - cgswords:tstream, r=nrcJeffrey Seyfried-1/+1
syntax-[breaking-change] cc #31645 (Only breaking because ast::TokenTree is now tokenstream::TokenTree.) This pull request refactors TokenTrees into their own file as src/libsyntax/tokenstream.rs, moving them out of src/libsyntax/ast.rs, in order to prepare for an accompanying TokenStream implementation (per RFC 1566).
2016-06-25Rollup merge of #34403 - jonathandturner:move_liberror, r=alexcrichtonJeffrey Seyfried-5/+5
This PR refactors the 'errors' part of libsyntax into its own crate (librustc_errors). This is the first part of a few refactorings to simplify error reporting and potentially support more output formats (like a standardized JSON output and possibly an --explain mode that can work with the user's code), though this PR stands on its own and doesn't assume further changes. As part of separating out the errors crate, I have also refactored the code position portion of codemap into its own crate (libsyntax_pos). While it's helpful to have the common code positions in a separate crate for the new errors crate, this may also enable further simplifications in the future.
2016-06-25Rollup merge of #34213 - josephDunne:trait_item_macros, r=jseyfriedJeffrey Seyfried-20/+33
**syntax-[breaking-change]** cc #31645 New `TraitItemKind::Macro` variant This change adds support for macro expansion inside trait items by adding the new `TraitItemKind::Macro` and associated parsing code.
2016-06-23Remove field `expr` of `ast::Block`Jeffrey Seyfried-10/+1
2016-06-23Address more travis errorsJonathan Turner-1/+1
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-4/+4
2016-06-23Auto merge of #34253 - jseyfried:improve_multi_modifiers, r=nrcbors-65/+34
Allow `MultiItemModifier`s to expand into zero or many items Fixes #34223. r? @nrc
2016-06-21Refactored tokentrees into their own files in preparation for tokenstreams. ↵cgswords-1/+1
Modified tests to point to the new file now.
2016-06-20Remove unit testsJeffrey Seyfried-258/+1
2016-06-20Fix hygiene regressionJeffrey Seyfried-3/+2
2016-06-18Auto merge of #34295 - jseyfried:cfg_decoration, r=eddybbors-6/+6
Perform `cfg` attribute processing on decorator-generated items Fixes https://users.rust-lang.org/t/unused-attribute-warning-for-custom-derive-attribute/6180. r? @nrc
2016-06-19Generalize and abstract `ThinAttributes`Jeffrey Seyfried-4/+4
2016-06-17Fix falloutJeffrey Seyfried-72/+52
2016-06-16Simplify gated cfg checkingJeffrey Seyfried-12/+14
2016-06-16Auto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrcbors-19/+61
Revert a change in the scope of macros imported from crates to fix a regression Fixes #34212. The regression was caused by #34032, which changed the scope of macros imported from extern crates to match the scope of macros imported from modules. r? @nrc
2016-06-16Strip unconfigured nodes from decorator-generated ASTJeffrey Seyfried-4/+6
2016-06-16Avoid expanding decorator-generated items twiceJeffrey Seyfried-2/+0
2016-06-16Allow `MultiItemModifier`s to expand into zero or many itemsJeffrey Seyfried-1/+1
2016-06-16Refactor MultiModifier expansionJeffrey Seyfried-65/+34
2016-06-14Remove the type parameter from `syntax::visit::Visitor`Jeffrey Seyfried-3/+3
2016-06-14Refactor away `WithAttrs` traitJeffrey Seyfried-24/+15
2016-06-14Change `fold_tt` and `fold_tts` to take token trees by value (instead of by ↵Jeffrey Seyfried-4/+4
reference)
2016-06-14Refactor away field `ctxt` of `ast::Mac_`Jeffrey Seyfried-1/+0
2016-06-13Auto merge of #33749 - jseyfried:fix_call_site_span, r=nrcbors-7/+1
Fix macro call site spans Fix macro call site spans. r? @nrc
2016-06-13Add support for macro expansion inside trait itemsJoseph Dunne-19/+31
2016-06-12Load macros from `#[macro_use]` crates earlier in expansionJeffrey Seyfried-10/+40
2016-06-12Add method `visit_with` to `MacroGenerable`Jeffrey Seyfried-9/+21
2016-06-11Strip `#[test]` nodes during `cfg` processing on non-test builds.Jeffrey Seyfried-0/+3
2016-06-09Add comment and clean up `expand_annotatable`Jeffrey Seyfried-8/+6
2016-06-09Load macros from `extern crate`s during expansion.Jeffrey Seyfried-19/+22
2016-06-08Auto merge of #34010 - jseyfried:decorate_expanded, r=nrcbors-13/+14
Run decorators on expanded AST Fixes #32950. r? @nrc
2016-06-01Remove redundant `check_for_macros` AST pass.Jeffrey Seyfried-19/+0
2016-06-01Run decorators on expanded AST.Jeffrey Seyfried-13/+14
2016-05-28Fix macro call site spansJeffrey Seyfried-7/+1