about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-06-26Rollup merge of #34436 - jseyfried:no_block_expr, r=eddybJeffrey Seyfried-96/+72
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-202/+177
Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`.
2016-06-26Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddybJeffrey Seyfried-349/+289
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-333/+237
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-26Rollup merge of #34385 - cgswords:tstream, r=nrcJeffrey Seyfried-262/+304
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-3852/+994
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-30/+18
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-87/+175
**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-24reexport errors from syntax. fix failing cfail testJonathan Turner-1/+4
2016-06-24Fix codemap tests to not double importJonathan Turner-1/+0
2016-06-24Improve `syntax::ast::*` type docs (examples, etc)Vincent Esche-36/+135
2016-06-24Reexport syntax_pos in codemap and fix some cfail testsJonathan Turner-1/+1
2016-06-24Add `ecx.stmt_semi()` and fix issues with the pretty-printerJeffrey Seyfried-3/+18
2016-06-23Refactor away duplicate method `ecx.block_all()`Jeffrey Seyfried-11/+6
2016-06-23make old school mode a bit more configurableJonathan Turner-18/+32
2016-06-23Remove field `expr` of `ast::Block`Jeffrey Seyfried-98/+52
2016-06-23Add missing refernce to RenderedLineJonathan Turner-1/+1
2016-06-23Move test helper functions to consolidated codemap testingJonathan Turner-63/+64
2016-06-23Actually consolidate the CodeMap testsJonathan Turner-517/+517
2016-06-23Consolidate codemap tests and fix more errors for travisJonathan Turner-2/+821
2016-06-23Address more travis errorsJonathan Turner-4/+7
2016-06-23Address comments and fix travis warningJonathan Turner-2/+2
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-3850/+153
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-23Cleanup commentsJeffrey Seyfried-4/+4
2016-06-21Refactored tokentrees into their own files in preparation for tokenstreams. ↵cgswords-262/+304
Modified tests to point to the new file now.
2016-06-20Merge PatKind::QPath into PatKind::Path in ASTVadim Petrochenkov-30/+18
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/+25
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-202/+181
2016-06-18Auto merge of #34310 - erickt:tuple-struct-attrs, r=nrcbors-1/+2
Pretty-print attributes on tuple structs and add tests This adds support to the pretty printer to print attributes added to tuple struct elements. Furthermore, it adds a test that makes sure we will print attributes on all variant data types.
2016-06-17Fix panic when using debugGuillaume Gomez-1/+1
2016-06-17Pretty-print attributes on tuple structs and add testsErick Tryzelaar-1/+2
This adds support to the pretty printer to print attributes added to tuple struct elements. Furthermore, it adds a test that makes sure we will print attributes on all variant data types.
2016-06-17Rename `ast::ExprKind::Again` -> `ast::ExprKind::Continue`Jeffrey Seyfried-6/+6
2016-06-17Fix falloutJeffrey Seyfried-328/+267
2016-06-17Refactor away `ast::Decl` and refactor `ast::Stmt`Jeffrey Seyfried-16/+14
2016-06-16Auto merge of #34315 - Manishearth:rollup, r=Manishearthbors-859/+859
Rollup of 4 pull requests - Successful merges: #34298, #34302, #34307, #34312 - Failed merges:
2016-06-17Rollup merge of #34312 - erickt:add-try, r=nikomatsakisManish Goregaokar-859/+859
Revert using ? for try! in the libsyntax pretty printer The use of ...?instead of try!(...) in libsyntax makes extracting libsyntax into syntex quite painful since it's not stable yet. This makes backports take a much longer time and causes a lot of problems for the syntex dependencies. Even if it was, it'd take a few release cycles until syntex would be able to use it. Since it's not stable and that this feature is just syntax sugar, it would be most helpful if we could remove it. cc #34311
2016-06-16Auto merge of #34272 - jseyfried:simplify_gated_cfg_checking, r=nrcbors-169/+95
Simplify gated cfg checking r? @nrc
2016-06-16Revert using ? for try! in the libsyntax pretty printerErick Tryzelaar-859/+859
The use of ...?instead of try!(...) in libsyntax makes extracting libsyntax into syntex quite painful since it's not stable yet. This makes backports take a much longer time and causes a lot of problems for the syntex dependencies. Even if it was, it'd take a few release cycles until syntex would be able to use it. Since it's not stable and that this feature is just syntax sugar, it would be most helpful if we could remove it. cc #34311
2016-06-16Simplify gated cfg checkingJeffrey Seyfried-169/+95
2016-06-16Auto merge of #34187 - luser:extern-crate-abspaths, r=michaelwoeristerbors-41/+76
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-41/+76
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/+72
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-16Auto merge of #34216 - jseyfried:nested_cfg_attr, r=nrcbors-1/+1
Support nested `cfg_attr` attributes Support arbitrarily deeply nested `cfg_attr` attributes (e.g. `#[cfg_attr(foo, cfg_attr(bar, baz))]`). This makes configuration idempotent. Currently, the nighties do not support any `cfg_attr` nesting. Stable and beta support just one level of `cfg_attr` nesting (expect for attributes on macro-expanded nodes, where no nesting is supported). This is a [breaking-change]. For example, the following would break: ```rust macro_rules! m { () => { #[cfg_attr(all(), cfg_attr(all(), cfg(foo)))] fn f() {} } } m!(); fn main() { f() } //~ ERROR unresolved name `f` ``` r? @nrc
2016-06-16Strip unconfigured nodes from decorator-generated ASTJeffrey Seyfried-4/+25
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