summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
AgeCommit message (Collapse)AuthorLines
2016-11-04Remove field `TtReader::next_tok`.Jeffrey Seyfried-5/+0
2016-11-04Improve `tt`-heavy expansion performance.Jeffrey Seyfried-3/+12
2016-11-03Move doc comment desugaring into the parser.Jeffrey Seyfried-28/+2
2016-11-03Avoid recontructing the `Parser` in `macro_parser.rs`.Jeffrey Seyfried-21/+16
2016-11-03Revert "macros: Improve `tt` fragments"Jeffrey Seyfried-13/+3
This reverts commit 41745f30f751364bdce14428b7d3ffa5dd028903.
2016-11-03Reduce the size of `Token` and make it cheaper to clone by refactoringJeffrey Seyfried-28/+31
`Token::Interpolated(Nonterminal)` -> `Token::Interpolated(Rc<Nonterminal>)`.
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-9/+4
2016-10-28Auto merge of #37373 - nnethercote:html5ever-more-more, r=nrcbors-11/+10
Avoid more allocations when compiling html5ever These three commits reduce the number of allocations performed when compiling html5ever from 13.2M to 10.8M, which speeds up compilation by about 2%. r? @nrc
2016-10-25Don't use `Rc` in `TokenTreeOrTokenTreeVec`.Nicholas Nethercote-3/+3
This avoids 800,000 allocations when compiling html5ever.
2016-10-25Use `SmallVector` for `TtReader::stack`.Nicholas Nethercote-3/+4
This avoids 800,000 heap allocations when compiling html5ever. It requires tweaking `SmallVector` a little.
2016-10-25Use `SmallVector` for the stack in `macro_parser::parse`.Nicholas Nethercote-6/+4
This avoids 800,000 heap allocations when compiling html5ever.
2016-10-24Refactor away fields `MacroDef::{use_locally, export}`.Jeffrey Seyfried-3/+2
2016-10-22Auto merge of #37318 - nnethercote:html5ever-more, r=nrc,eddybbors-14/+26
Avoid some allocations in the macro parser These three commits reduce the number of heap allocations done when compiling rustc-benchmarks/html5ever-2016-08-25 by 20%, from 16.5M to 13.3M. This speeds up (debug) compilation of it with a stage1 compiler by about 7%.
2016-10-21Replace the `String` in `ParseResult::Failure` with `Token`.Nicholas Nethercote-13/+25
This lets us delay creation of failure messages until they are needed, which avoids ~1.6M allocations in html5ever.
2016-10-21Avoid an unnecessary clone in `generic_extensions`.Nicholas Nethercote-2/+2
This avoids ~800,000 allocations in html5ever.
2016-10-21Avoid an unnecessary clone in `macro_parser::parse`.Nicholas Nethercote-1/+1
This avoids ~800,000 allocations in html5ever.
2016-10-19Improve `$crate`.Jeffrey Seyfried-38/+5
2016-10-19Rollup merge of #37208 - jseyfried:fix_partially_consumed_tokens_in_macros, ↵Eduard-Mihai Burtescu-12/+14
r=nrc macros: fix partially consumed tokens in macro matchers Fixes #37175. This PR also avoids re-transcribing the tokens consumed by a matcher (and cloning the `TtReader` once per matcher), which improves expansion performance of the test case from #34630 by ~8%. r? @nrc
2016-10-17Fix partially consumed tokens in macro matchers.Jeffrey Seyfried-12/+14
2016-10-14Avoid many CrateConfig clones.Nicholas Nethercote-3/+3
This commit changes `ExtCtx::cfg()` so it returns a `CrateConfig` reference instead of a clone. As a result, it also changes all of the `cfg()` callsites to explicitly clone... except one, because the commit also changes `macro_parser::parse()` to take `&CrateConfig`. This is good, because that function can be hot, and `CrateConfig` is expensive to clone. This change almost halves the number of heap allocations done by rustc for `html5ever` in rustc-benchmarks suite, which makes compilation 1.20x faster.
2016-09-28Rollup merge of #36789 - jseyfried:non_inline_mod_in_block, r=nikomatsakisJonathan Turner-1/+1
Allow more non-inline modules in blocks Currently, non-inline modules without a `#[path]` attribute are not allowed in blocks. This PR allows non-inline modules that have an ancestor module with a `#[path]` attribute, provided there is not a nearer ancestor block. For example, ```rust fn main() { #[path = "..."] mod foo { mod bar; //< allowed by this PR fn f() { mod bar; //< still an error } } } ``` Fixes #36772. r? @nikomatsakis
2016-09-28Allow non-inline modules in more places.Jeffrey Seyfried-1/+1
2016-09-26Rollup merge of #36721 - TimNN:infinite-emptiness, r=nrcJonathan Turner-1/+38
reject macros with empty repetitions Fixes #5067 by checking the lhs of `macro_rules!` for repetitions which could match an empty token tree.
2016-09-26reject macros with empty repetitionsTim Neumann-1/+38
2016-09-26Refactor `ensure_complete_parse`.Jeffrey Seyfried-24/+11
2016-09-26Remove `TokResult`.Jeffrey Seyfried-1/+1
2016-09-26Refactor `parse_expansion` out of `ResultAnyMacro`.Jeffrey Seyfried-88/+12
2016-09-24Load macros from `#[macro_use]` extern crates in `resolve`.Jeffrey Seyfried-4/+5
2016-09-24Refactor `ext::tt::macro_rules::compile` to take a `ParseSess` instead of an ↵Jeffrey Seyfried-39/+32
`ExtCtxt`.
2016-09-23reviewer comments and rebasingNick Cameron-7/+4
2016-09-15Remove `MacroRulesTT`.Jeffrey Seyfried-3/+36
2016-09-13Move macro resolution into `librustc_resolve`.Jeffrey Seyfried-2/+2
2016-09-05Refactor `SyntaxEnv`.Jeffrey Seyfried-2/+2
2016-09-05In `Parser` and `ExtCtxt`, replace fields `filename` and `mod_path_stack`Jeffrey Seyfried-2/+1
with a single field `directory: PathBuf`.
2016-09-04Replace `_, _` with `..`Vadim Petrochenkov-2/+2
2016-08-07Make metavariables hygienic.Jeffrey Seyfried-12/+12
2016-07-23macros: Improve `tt` fragmentsJeffrey Seyfried-3/+13
2016-07-13Start a best-effort warning cycle.Jeffrey Seyfried-1/+1
2016-07-13cleanup: Refactor parser method `finish_parsing_statement` -> `parse_full_stmt`.Jeffrey Seyfried-7/+1
2016-07-12Parse macro-expanded statements like ordinary statements.Jeffrey Seyfried-1/+7
2016-07-06Auto merge of #34652 - jseyfried:fix_expansion_perf, r=nrcbors-6/+7
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-04Revert "Change `fold_tt` and `fold_tts` to take token trees by value ↵Jeffrey Seyfried-6/+7
(instead of by reference)" This reverts commit 5bf7970ac70b4e7781e7b2f3816720aa62fac6fd.
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-6/+3
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-06-26Rollup merge of #33943 - jseyfried:libsyntax_cleanup, r=nrcJeffrey Seyfried-24/+21
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-26Rollup merge of #34385 - cgswords:tstream, r=nrcJeffrey Seyfried-18/+21
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-8/+8
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-23Move errors from libsyntax to its own crateJonathan Turner-8/+8
2016-06-21Refactored tokentrees into their own files in preparation for tokenstreams. ↵cgswords-18/+21
Modified tests to point to the new file now.
2016-06-14Change `fold_tt` and `fold_tts` to take token trees by value (instead of by ↵Jeffrey Seyfried-23/+21
reference)
2016-06-13Add support for macro expansion inside trait itemsJoseph Dunne-0/+15