summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2016-09-20serialize: allow specifying the default behavior for specializations.Eduard Burtescu-2/+12
2016-09-20rustc_metadata: go only through rustc_serialize in astencode.Eduard Burtescu-5/+33
2016-09-11Documentation of what does for each typeathulappadan-0/+1
2016-09-04Replace `_, _` with `..`Vadim Petrochenkov-1/+1
2016-09-04Replace `_, _, _` with `..`Vadim Petrochenkov-1/+1
2016-09-03Add unions to ASTVadim Petrochenkov-1/+1
2016-08-29Future proof the AST for `union`.Jeffrey Seyfried-0/+5
2016-08-28Rollup merge of #35850 - SergioBenitez:master, r=nrcJeffrey Seyfried-8/+50
Implement RFC#1559: allow all literals in attributes Implemented rust-lang/rfcs#1559, tracked by #34981.
2016-08-28Rollup merge of #35480 - KiChjang:e0379-bonus, r=nikomatsakisJeffrey Seyfried-2/+2
Move E0379 check from typeck to ast validation Part of #35233. Extension of #35338, #35364. Fixes #35404.
2016-08-28Rollup merge of #35618 - jseyfried:ast_view_path_refactor, r=eddybJeffrey Seyfried-34/+6
Refactor `PathListItem`s This refactors away variant `Mod` of `ast::PathListItemKind` and refactors the remaining variant `Ident` to a struct `ast::PathListItem_`.
2016-08-27Change Constness to Spanned<Constness>Keith Yeung-2/+2
2016-08-25Implement RFC#1559: allow all literals in attributes.Sergio Benitez-8/+50
2016-08-21Refactor away variant `ast::PathListItemKind::Mod`Jeffrey Seyfried-34/+6
and refactor `ast::PathListItemKind::Ident` -> `ast::PathListItem_`.
2016-08-18Add Span field for Generics structsGuillaume Gomez-2/+4
2016-08-13Rename empty/bang to neverAndrew Cann-2/+2
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Remove obsolete divergence related stuffAndrew Cann-4/+0
Replace FnOutput with Ty Replace FnConverging(ty) with ty Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-13Start implementation of RFC 1216 (make ! a type)Andrew Cann-0/+3
Add `TyKind::Empty` and fix resulting build errors.
2016-08-12syntax: add anonymized type syntax, i.e. impl TraitA+TraitB.Eduard Burtescu-0/+2
2016-07-17Rename `mtwt` to `hygiene`Jeffrey Seyfried-1/+1
2016-07-17Clean up and encapsulate `syntax::ext::mtwt`Jeffrey Seyfried-19/+3
2016-07-15Auto merge of #34570 - jseyfried:no_rename, r=nrcbors-36/+1
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-14Instead of renaming, treat differently marked identifiers as unequalJeffrey Seyfried-36/+1
2016-07-12Clean up statement parsing without changing the semantics of `parse_stmt`.Jeffrey Seyfried-0/+13
2016-06-28cleanup: refactor away `ast::NodeIdAssigner`Jeffrey Seyfried-10/+0
2016-06-26Rollup merge of #34436 - jseyfried:no_block_expr, r=eddybJeffrey Seyfried-4/+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-5/+4
Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`.
2016-06-26Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddybJeffrey Seyfried-34/+17
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-30/+1
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-26Rollup merge of #34385 - cgswords:tstream, r=nrcJeffrey Seyfried-191/+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-1/+2
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-10/+5
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-0/+1
**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-24Improve `syntax::ast::*` type docs (examples, etc)Vincent Esche-36/+135
2016-06-23Remove field `expr` of `ast::Block`Jeffrey Seyfried-4/+1
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-1/+2
2016-06-23Cleanup commentsJeffrey Seyfried-4/+4
2016-06-21Refactored tokentrees into their own files in preparation for tokenstreams. ↵cgswords-191/+1
Modified tests to point to the new file now.
2016-06-20Merge PatKind::QPath into PatKind::Path in ASTVadim Petrochenkov-10/+5
2016-06-19Generalize and abstract `ThinAttributes`Jeffrey Seyfried-4/+5
2016-06-17Rename `ast::ExprKind::Again` -> `ast::ExprKind::Continue`Jeffrey Seyfried-1/+1
2016-06-17Fix falloutJeffrey Seyfried-20/+1
2016-06-17Refactor away `ast::Decl` and refactor `ast::Stmt`Jeffrey Seyfried-16/+14
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-14Remove inherent method `attrs()` on AST nodes. `attrs()` is now a method of ↵Jeffrey Seyfried-29/+1
trait `HasAttrs`.
2016-06-13Add support for macro expansion inside trait itemsJoseph Dunne-0/+1
2016-06-11Remove last traces of identifier hygiene from HIRVadim Petrochenkov-4/+0
2016-06-01Auto merge of #33794 - petrochenkov:sanity, r=nrcbors-0/+10
Add AST validation pass and move some checks to it The purpose of this pass is to catch constructions that fit into AST data structures, but not permitted by the language. As an example, `impl`s don't have visibilities, but for convenience and uniformity with other items they are represented with a structure `Item` which has `Visibility` field. This pass is intended to run after expansion of macros and syntax extensions (and before lowering to HIR), so it can catch erroneous constructions that were generated by them. This pass allows to remove ad hoc semantic checks from the parser, which can be overruled by syntax extensions and occasionally macros. The checks can be put here if they are simple, local, don't require results of any complex analysis like name resolution or type checking and maybe don't logically fall into other passes. I expect most of errors generated by this pass to be non-fatal and allowing the compilation to proceed. I intend to move some more checks to this pass later and maybe extend it with new checks, like, for example, identifier validity. Given that syntax extensions are going to be stabilized in the measurable future, it's important that they would not be able to subvert usual language rules. In this patch I've added two new checks - a check for labels named `'static` and a check for lifetimes and labels named `'_`. The first one gives a hard error, the second one - a future compatibility warning. Fixes https://github.com/rust-lang/rust/issues/33059 ([breaking-change]) cc https://github.com/rust-lang/rfcs/pull/1177 r? @nrc
2016-05-29Auto merge of #33929 - petrochenkov:pathir, r=eddybbors-8/+4
Separate bindings from other patterns in HIR Now when name resolution is done on AST, we can avoid dumping everything that looks like an identifier into `PatKind::Ident` in HIR. `hir::PatKind::Ident` is removed, fresh bindings are now called `hir::PatKind::Binding`, everything else goes to `hir::PatKind::Path`. I intend to do something with `PatKind::Path`/`PatKind::QPath` as well using resolution results, but it requires some audit and maybe some deeper refactoring of relevant resolution/type checking code to do it properly. I'm submitting this part of the patch earlier to notify interested parties that I'm working on this. cc @jseyfried r? @eddyb
2016-05-28Move some other checks to AST sanity passVadim Petrochenkov-0/+10