about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
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/+17
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/+17
2016-06-27Auto merge of #34424 - jseyfried:breaking_batch, r=Manishearthbors-301/+324
Batch up libsyntax breaking changes Batch of the following syntax-[breaking-change] changes: - #34213: Add a variant `Macro` to `TraitItemKind` - #34368: Merge the variant `QPath` of `PatKind` into the variant `PatKind::Path` - #34385: Move `syntax::ast::TokenTree` into a new module `syntax::tokenstream` - #33943: - Remove the type parameter from `visit::Visitor` - Remove `attr::WithAttrs` -- use `attr::HasAttrs` instead. - Change `fold_tt`/`fold_tts` to take token trees by value and avoid wrapping token trees in `Rc`. - Remove the field `ctxt` of `ast::Mac_` - Remove inherent method `attrs()` of types -- use the method `attrs` of `HasAttrs` instead. - #34316: - Remove `ast::Decl`/`ast::DeclKind` and add variants `Local` and `Item` to `StmtKind`. - Move the node id for statements from the `StmtKind` variants to a field of `Stmt` (making `Stmt` a struct instead of an alias for `Spanned<StmtKind>`) - Rename `ast::ExprKind::Again` to `Continue`. - #34339: Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>` - Use `.into()` in convert between `Vec<Attribute>` and `ThinVec<Attribute>` - Use autoderef instead of `.as_attr_slice()` - #34436: Remove the optional expression from `ast::Block` and instead use a `StmtKind::Expr` at the end of the statement list. - #34403: Move errors into a separate crate (unlikely to cause breakage)
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-49/+38
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-11/+11
Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`.
2016-06-26Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddybJeffrey Seyfried-87/+82
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-74/+55
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-26Rollup merge of #34385 - cgswords:tstream, r=nrcJeffrey Seyfried-48/+59
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-21/+22
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 #34368 - petrochenkov:astqpath, r=ManishearthJeffrey Seyfried-1/+1
The AST part of https://github.com/rust-lang/rust/pull/34365 plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645
2016-06-25Rollup merge of #34213 - josephDunne:trait_item_macros, r=jseyfriedJeffrey Seyfried-20/+66
**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-24Revert a change to the relative path for macro-expanded `include!`sJeffrey Seyfried-1/+2
2016-06-24Add `ecx.stmt_semi()` and fix issues with the pretty-printerJeffrey Seyfried-0/+5
2016-06-23Refactor away duplicate method `ecx.block_all()`Jeffrey Seyfried-10/+5
2016-06-23Remove field `expr` of `ast::Block`Jeffrey Seyfried-48/+32
2016-06-23Address more travis errorsJonathan Turner-1/+1
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-20/+21
2016-06-23Auto merge of #34253 - jseyfried:improve_multi_modifiers, r=nrcbors-92/+66
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-48/+59
Modified tests to point to the new file now.
2016-06-20Merge PatKind::QPath into PatKind::Path in ASTVadim Petrochenkov-1/+1
2016-06-20Remove unit testsJeffrey Seyfried-445/+3
2016-06-20Fix hygiene regressionJeffrey Seyfried-151/+44
2016-06-18Auto merge of #34295 - jseyfried:cfg_decoration, r=eddybbors-6/+16
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-11/+11
2016-06-17Fix falloutJeffrey Seyfried-87/+82
2016-06-16Auto merge of #34272 - jseyfried:simplify_gated_cfg_checking, r=nrcbors-16/+14
Simplify gated cfg checking r? @nrc
2016-06-16Simplify gated cfg checkingJeffrey Seyfried-16/+14
2016-06-16Auto merge of #34187 - luser:extern-crate-abspaths, r=michaelwoeristerbors-2/+2
Add an abs_path member to FileMap, use it when writing debug info. Fixes #34179. When items are inlined from extern crates, the filename in the debug info is taken from the FileMap that's serialized in the rlib metadata. Currently this is just FileMap.name, which is whatever path is passed to rustc. Since libcore and libstd are built by invoking rustc with relative paths, they wind up with relative paths in the rlib, and when linked into a binary the debug info uses relative paths for the names, but since the compilation directory for the final binary, tools trying to read source filenames will wind up with bad paths. We noticed this in Firefox with source filenames from libcore/libstd having bad paths. This change stores an absolute path in FileMap.abs_path, and uses that if available for writing debug info. This is not going to magically make debuggers able to find the source, but it will at least provide sensible paths.
2016-06-16Add an abs_path member to FileMap, use it when writing debug info.Ted Mielczarek-2/+2
When items are inlined from extern crates, the filename in the debug info is taken from the FileMap that's serialized in the rlib metadata. Currently this is just FileMap.name, which is whatever path is passed to rustc. Since libcore and libstd are built by invoking rustc with relative paths, they wind up with relative paths in the rlib, and when linked into a binary the debug info uses relative paths for the names, but since the compilation directory for the final binary, tools trying to read source filenames will wind up with bad paths. We noticed this in Firefox with source filenames from libcore/libstd having bad paths. This change stores an absolute path in FileMap.abs_path, and uses that if available for writing debug info. This is not going to magically make debuggers able to find the source, but it will at least provide sensible paths.
2016-06-16Auto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrcbors-20/+62
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/+16
2016-06-16Avoid expanding decorator-generated items twiceJeffrey Seyfried-2/+0
2016-06-16Allow `MultiItemModifier`s to expand into zero or many itemsJeffrey Seyfried-12/+14
2016-06-16Refactor MultiModifier expansionJeffrey Seyfried-65/+34
2016-06-16Implement `HasAttrs` for `Annotatable`Jeffrey Seyfried-16/+19
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-38/+30
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-23/+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/+64
2016-06-12Load macros from `#[macro_use]` crates earlier in expansionJeffrey Seyfried-11/+41
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/+8
2016-06-09Load macros from `extern crate`s during expansion.Jeffrey Seyfried-20/+42
2016-06-08Auto merge of #34010 - jseyfried:decorate_expanded, r=nrcbors-13/+14
Run decorators on expanded AST Fixes #32950. r? @nrc