about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-07-11Factor the `RefCell` out of the `Interner`.Jeffrey Seyfried-66/+41
2016-07-11Refactor `get_ident_interner` -> `with_ident_interner`.Jeffrey Seyfried-12/+13
2016-07-11Remove `Interner<T>` and rename `StrInterner` to `Interner`.Jeffrey Seyfried-139/+16
2016-07-11Encapsulate `RcStr` in `syntax::util::interner`.Jeffrey Seyfried-62/+25
2016-07-11Remove unused field `interner` from the parser.Jeffrey Seyfried-2/+0
2016-07-11Move E0533 to E0558 (because of external change)Guillaume Gomez-24/+24
2016-07-11Fix typosggomez-26/+28
2016-07-11Add E0537 error explanationGuillaume Gomez-1/+31
2016-07-11Add E0536 error explanationGuillaume Gomez-3/+27
2016-07-11Add E0535 error explanationGuillaume Gomez-1/+31
2016-07-11Add E0534 error explanationGuillaume Gomez-2/+35
2016-07-11Add E0533 error explanationGuillaume Gomez-2/+16
2016-07-08Rollup merge of #34691 - jseyfried:remove_erroneous_unit_struct_checks, r=nrcManish Goregaokar-72/+11
parser: Remove outdated checks for empty braced struct expressions (`S {}`) This is a pure refactoring. r? @nrc
2016-07-07Preliminary implementation for TokenStreams and TokenSlices, including unit ↵cgswords-39/+1121
tests and associated operations.
2016-07-06Auto merge of #34652 - jseyfried:fix_expansion_perf, r=nrcbors-53/+72
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-06Remove outdated checks for empty braced struct expressions (i.e. `UnitStruct ↵Jeffrey Seyfried-72/+11
{}`).
2016-07-06Auto merge of #34654 - jseyfried:configure_multi_modified, r=nrcbors-1/+5
Perform `cfg` attribute processing on `MultiModifier`-generated items Fixes https://users.rust-lang.org/t/unused-attribute-warning-for-custom-derive-attribute/6180. r? @nrc
2016-07-06Auto merge of #34546 - jseyfried:cfg_attr_path, r=nrcbors-3/+10
Support `cfg_attr` on `path` attributes Fixes #25544. This is technically a [breaking-change]. For example, the following would break: ```rust mod foo; // Suppose `foo.rs` existed in the appropriate location ```
2016-07-05Specific error message for missplaced doc commentsEsteban Küber-17/+45
Identify when documetation comments have been missplaced in the following places: * After a struct element: ```rust // file.rs: struct X { a: u8 /** document a */, } ``` ```bash $ rustc file.rs file.rs:2:11: 2:28 error: found documentation comment that doesn't document anything file.rs:2 a: u8 /** document a */, ^~~~~~~~~~~~~~~~~ file.rs:2:11: 2:28 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` * As the last line of a struct: ```rust // file.rs: struct X { a: u8, /// incorrect documentation } ``` ```bash $ rustc file.rs file.rs:3:5: 3:27 error: found a documentation comment that doesn't document anything file.rs:3 /// incorrect documentation ^~~~~~~~~~~~~~~~~~~~~~ file.rs:3:5: 3:27 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` * As the last line of a `fn`: ```rust // file.rs: fn main() { let x = 1; /// incorrect documentation } ``` ```bash $ rustc file.rs file.rs:3:5: 3:27 error: found a documentation comment that doesn't document anything file.rs:3 /// incorrect documentation ^~~~~~~~~~~~~~~~~~~~~~ file.rs:3:5: 3:27 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` Fix #27429, #30322
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-53/+72
(instead of by reference)" This reverts commit 5bf7970ac70b4e7781e7b2f3816720aa62fac6fd.
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-47/+27
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
2016-07-02Rollup merge of #34531 - GuillaumeGomez:libsyntax_err_codes, r=jonathandturnerManish Goregaokar-55/+142
Add error codes in libsyntax r? @jonathandturner Fixes #34526
2016-06-30Add comments on error code listGuillaume Gomez-27/+27
2016-06-30Auto merge of #34541 - jseyfried:rollup, r=jseyfriedbors-22/+17
Rollup of 5 pull requests - Successful merges: #34105, #34305, #34512, ~~#34531,~~ #34547
2016-06-29Fix testsggomez-1/+1
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-37/+20
Miscellaneous macro expansion cleanup and groundwork r? @nrc
2016-06-29Rollup merge of #34446 - jseyfried:refactor_decorators, r=nrcManish Goregaokar-78/+33
Treat `MultiDecorator`s as a special case of `MultiModifier`s This deals with #32950 by using @durka's [option 1](https://github.com/rust-lang/rust/pull/33769#issuecomment-221774136). r? @nrc
2016-06-29Fix pretty-printing of lifetime boundSeo Sanghyeon-22/+17
2016-06-29Add error codes in libsyntaxggomez-55/+142
2016-06-29Give `ast::ExprKind::Paren` no-op expressions the same node ids as their ↵Jeffrey Seyfried-2/+11
children.
2016-06-29Support `cfg_attr` on `path` attributesJeffrey Seyfried-3/+10
2016-06-29Refactor away `parser.commit_stmt_expecting()`Jeffrey Seyfried-5/+1
2016-06-29Treat `MultiDecorator`s as a special case of `MultiModifier`sJeffrey Seyfried-78/+33
2016-06-28cleanup: refactor away `ast::NodeIdAssigner`Jeffrey Seyfried-10/+0
2016-06-28cleanup: use `DummyResult` to implement `MacroGenerable::dummy`Jeffrey Seyfried-19/+17
2016-06-28cleanup: don't count attributes on an item in a statement position as on the ↵Jeffrey Seyfried-8/+3
statement
2016-06-27Auto merge of #34424 - jseyfried:breaking_batch, r=Manishearthbors-5165/+2221
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-27Fix `Cargo.toml`sJeffrey Seyfried-1/+2
2016-06-27Forbid type parameters and global paths in macro invocationsJeffrey Seyfried-1/+1
2016-06-26Auto merge of #34450 - jseyfried:fix_include_path, r=nrcbors-1/+2
Revert a change to the relative path for macro-expanded `include!`s Fixes #34431 (c.f. discussion in that issue). r? @nrc
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.