about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt/macro_parser.rs
AgeCommit message (Collapse)AuthorLines
2019-03-23syntax: Remove warning for unnecessary path disambiguatorsVadim Petrochenkov-1/+1
2019-03-06Panic when unmatched delimiters aren't emittedEsteban Küber-1/+1
2019-02-18Avoid a `clone()` in `transcribe()`.Nicholas Nethercote-9/+10
The current code (expensively) clones the value within an `Rc`. This commit changes things so that the `Rc` itself is (cheaply) cloned instead, avoid some allocations. This requires converting a few `Rc` instances to `Lrc`.
2019-02-18Remove `LazyTokenStream`.Nicholas Nethercote-5/+5
It's present within `Token::Interpolated` as an optimization, so that if a nonterminal is converted to a `TokenStream` multiple times, the first-computed value is saved and reused. But in practice it's not needed. `interpolated_to_tokenstream()` is a cold function: it's only called a few dozen times while compiling rustc itself, and a few hundred times across the entire `rustc-perf` suite. Furthermore, when it is called, it is almost always the first conversion, so no benefit is gained from it. So this commit removes `LazyTokenStream`, along with the now-unnecessary `Token::interpolated()`. As well as a significant simplification, the removal speeds things up slightly, mostly due to not having to `drop` the `LazyTokenStream` instances.
2019-02-13Rollup merge of #58273 - taiki-e:rename-dependency, r=matthewjasperMazdak Farrokhzad-2/+2
Rename rustc_errors dependency in rust 2018 crates I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules. Related: rust-lang/cargo#5653 cc #58099 r? @Centril
2019-02-13Cleanup importsTaiki Endo-2/+2
2019-02-13Rename rustc_errors dependency in rust 2018 cratesTaiki Endo-1/+1
2019-02-10rustc: doc commentsAlexander Regueiro-9/+9
2019-02-07libsyntax => 2018Taiki Endo-15/+16
2019-01-09Change `String` to `&'static str` in `ParseResult::Failure`.Nicholas Nethercote-3/+3
This avoids 770,000 allocations when compiling the `html5ever` benchmark, reducing instruction counts by up to 2%.
2019-01-03Fix repeated word typosWiktor Kuchta-1/+1
Found with `git grep -P '\b([a-z]+)\s+\1\b'`
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-4/+4
2018-12-04Remove redundant cloneShotaro Yamada-1/+1
2018-11-23Reword incorrect macro invocation primary labelEsteban Küber-4/+9
2018-11-23Point at end of macro arm when encountering EOFEsteban Küber-2/+9
Fix #52866
2018-11-13Rollup merge of #55870 - waywardmonkeys:typo-fixes, r=wesleywiserkennytm-1/+1
Fix typos.
2018-11-12Make `MatcherPos::stack` a `SmallVec`.Niko Matsakis-34/+57
This avoids some allocations.
2018-11-11Fix typos.Bruce Mitchener-1/+1
2018-11-05Auto merge of #55451 - estebank:arg-doc, r=pnkfelixbors-1/+1
Custom diagnostic when trying to doc comment argument When writing ``` pub fn f( /// Comment id: u8, ) {} ``` Produce a targeted diagnostic ``` error: documentation comments cannot be applied to method arguments --> $DIR/fn-arg-doc-comment.rs:2:5 | LL | /// Comment | ^^^^^^^^^^^ doc comments are not allowed here ``` Fix #54801.
2018-11-01Use `SmallVec` for the inner vectors in `MatcherPos::matches`.Nicholas Nethercote-5/+7
This avoids some allocations.
2018-11-01Share empty `Vec`s more within `MatcherPos::matches`.Nicholas Nethercote-4/+9
`create_matches` creates a `Vec<Rc<Vec<NamedMatch>>>`. Even though all the inner `Vec`s are empty, each one is created separately. This commit changes `create_matches` so it instead creates one empty inner `Vec`, and shares it. The commit also changes `MatcherPos::matches` to a boxed slice, because its length doesn't change.
2018-10-28Provide specific label for patern parsing errorEsteban Küber-1/+1
2018-09-26Remove OneVectorljedrz-6/+6
2018-09-08Rename sp_lo to sp_openDavid Tolnay-10/+10
2018-09-08Track distinct spans for open and close delimiterDavid Tolnay-8/+8
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-5/+5
2018-08-23Use optimized SmallVec implementationIgor Gutorov-1/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-2/+2
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-7/+7
2018-07-16cleanup unnecessary elseMichael Lamparski-6/+4
2018-07-07fix perf issue in macro parserMichael Lamparski-1/+8
For a fuller description of the performance issue fixed by this: https://github.com/rust-lang/rust/issues/51754#issuecomment-403242159
2018-06-10Enable fall through past $:lifetime matcherDavid Tolnay-0/+8
2018-05-27innacurate -> inaccurateTakanori Ishibashi-1/+1
2018-05-26Add `Ident::as_str` helperVadim Petrochenkov-2/+2
2018-05-20Auto merge of #50855 - nnethercote:fewer-macro_parser-allocs, r=petrochenkovbors-23/+71
Speed up the macro parser These three commits reduce the number of allocations done by the macro parser, in some cases dramatically. For example, for a clean check builds of html5ever, the number of allocations is reduced by 40%. Here are the rustc-benchmarks that are sped up by at least 1%. ``` html5ever-check avg: -6.6% min: -10.3% max: -4.1% html5ever avg: -5.2% min: -9.5% max: -2.8% html5ever-opt avg: -4.3% min: -9.3% max: -1.6% crates.io-check avg: -1.8% min: -2.9% max: -0.6% crates.io-opt avg: -1.0% min: -2.2% max: -0.1% crates.io avg: -1.1% min: -2.2% max: -0.2% ```
2018-05-18Introduce `MatcherPosHandle`.Nicholas Nethercote-11/+59
This lets us store most `MatcherPos` instances on the stack. This speeds up various runs of html5ever, the best by 3%.
2018-05-17Change `TokenTreeOrTokenTreeVec` to `TokenTreeOrTokenTreeSlice`.Nicholas Nethercote-19/+19
This avoids a `to_owned` call that can be hot, speeding up the various runs of html5ever by 1--5%, and some runs of crates.io by 2--3%.
2018-05-13Macros: Add a 'literal' fragment specifierDan Aloni-0/+2
Implements RFC 1576. See: https://github.com/rust-lang/rfcs/blob/master/text/1576-macros-literal-matcher.md Changes are mostly in libsyntax, docs, and tests. Feature gate is enabled for 1.27.0. Many thanks to Vadim Petrochenkov for following through code reviews and suggestions. Example: ````rust macro_rules! test_literal { ($l:literal) => { println!("literal: {}", $l); }; ($e:expr) => { println!("expr: {}", $e); }; } fn main() { let a = 1; test_literal!(a); test_literal!(2); test_literal!(-3); } ``` Output: ``` expr: 1 literal: 2 literal: -3 ```
2018-05-03check if the token is a lifetime before parsingrleungx-1/+7
2018-04-06Make lifetime nonterminals closer to identifier nonterminalsVadim Petrochenkov-2/+2
2018-04-06Remove more duplicated spansVadim Petrochenkov-1/+1
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-3/+3
2018-03-18Return a is_raw parameter from Token::ident rather than having separate methods.Lymia Aluysia-2/+2
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-9/+10
2018-03-17Reject `_` in `ident` matcherVadim Petrochenkov-17/+19
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-2/+1
2018-01-30Update a few commentsMark Mansi-1/+0
2018-01-30Fix trailing whitespaceMark Mansi-1/+1
2018-01-30Attempted fix for `?` kleene opMark Mansi-23/+21